# Load text from string This article explains how to load values from variables of string type when using GroupDocs.Comparison for Java. [GroupDocs.Comparison](https://products.groupdocs.com/comparison/java) allows you to compare values from the `String` type variables. To compare text from variables, follow these steps: 1. Instantiate the [LoadOptions](https://reference.groupdocs.com/comparison/java/com.groupdocs.comparison.options.load/loadoptions) object. Set the [LoadText](https://reference.groupdocs.com/comparison/java/com.groupdocs.comparison.options.load/loadoptions/#setLoadText-boolean-) property to `true` (this indicates that passed string contains text to be compared, not file path). 2. Instantiate the [Comparer](https://reference.groupdocs.com/comparison/java/com.groupdocs.comparison/comparer) object. Specify the source variable of the `String` type and the [LoadOptions](https://reference.groupdocs.com/comparison/java/com.groupdocs.comparison.options.load/loadoptions) object created in the previous step. 3. Call the [add()](https://reference.groupdocs.com/comparison/java/com.groupdocs.comparison/comparer/#add-java.lang.String-) method. Specify target variable of the `String` type and the [LoadOptions](https://reference.groupdocs.com/comparison/java/com.groupdocs.comparison.options.load/loadoptions) object created in the previous step. 4. Call the [Comparer](https://reference.groupdocs.com/comparison/java/com.groupdocs.comparison/comparer) method. 5. Call the [getResultString](https://reference.groupdocs.com/comparison/java/com.groupdocs.comparison/comparer/#getResultString--) method to get string with comparison result. The following code snippet shows how to load values from variables: {{< tabs "example1">}} {{< tab "Java" >}} ```java import com.groupdocs.comparison.Comparer; import com.groupdocs.comparison.options.load.LoadOptions; // ... try (Comparer comparer = new Comparer("source text", new LoadOptions(true))) { comparer.add("target text", new LoadOptions(true)); comparer.compare(); String result = comparer.getResultString(); } ``` {{< /tab >}} {{< /tabs >}} The result is as follows: ![](https://docs.groupdocs.com/comparison/java/images/load-text-from-string.png) The following code snippet shows how to combine the different ways of specifying documents: {{< tabs "example2">}} {{< tab "Java" >}} ```java import com.groupdocs.comparison.Comparer; import com.groupdocs.comparison.options.load.LoadOptions; import java.io.FileInputStream; import java.io.InputStream; // ... try (Comparer comparer = new Comparer(sourceInputStream)) { comparer.add("target text", new LoadOptions(true)); comparer.compare(); String result = comparer.getResultString(); } ``` {{< /tab >}} {{< /tabs >}}