Compare two strings in ANT
<p>Hy!</p>

<p>I have to compare two strings in ANT with <code>&lt;equals&gt;</code> task but even if the console show the correctly string, It's doesn't work for my code. This is the code :</p>

<pre><code>&lt;echo file="file.txt" append="true"&gt;AB${line.separator}&lt;/echo&gt;
&lt;echo file="file.txt" append="true"&gt;CD${line.separator}&lt;/echo&gt;

&lt;loadfile property="content" srcFile="file.txt"&gt;
    &lt;filterchain&gt;
      &lt;filterreader classname="org.apache.tools.ant.filters.HeadFilter"&gt;
       &lt;param name="lines" value="1" /&gt;
      &lt;/filterreader&gt;
    &lt;/filterchain&gt;
&lt;/loadfile&gt;
&lt;echo&gt;${content}&lt;/echo&gt;

            &lt;if&gt;
                &lt;equals arg1="${content}" arg2="AB" /&gt;
                  &lt;then&gt;&lt;echo message="OK"/&gt;&lt;/then&gt;
                  &lt;else&gt;&lt;echo message="not OK"/&gt;&lt;/else&gt;
            &lt;/if&gt;
</code></pre>

<p>the result of the build is :</p>

<pre><code>11:24:23      [echo] AB
11:24:23      [echo] not OK
</code></pre>

<p>Can you tell me how to fix this please? and thnks :)</p>