I don't think you can check for string content like that; the following
works for me (you'll need commons.lang on your classpath):
<goal name="filetest">
<util:loadText file="test.txt" var="content"></util:loadText>
<j:invokeStatic className="org.apache.commons.lang.StringUtils"
method="contains" var="contains">
<j:arg value="${content}" type="java.lang.String"/>
<j:arg value="special string;" type="java.lang.String"/>
</j:invokeStatic>
<j:choose>
<j:when test="${contains}">
<echo>gut</echo>
</j:when>
<j:otherwise>
<echo>schlecht</echo>
</j:otherwise>
</j:choose>
</goal>
HTH,
-Lukas
mathapfahl wrote:
Hi,
I have a problem. I want to read the content of a file. If a special string
is in the file, then I want to go further. If not I want to write the string
in the file.
Does anyone have an idea how I should realize this ?
I begin with
<goal name="filetest">
<util:loadText file="test.txt" var="content"></util:loadText>
<ant:if test="${content.contains('special string;')}">
<echo>gut</echo>
</ant:if>
</goal>
please help me
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]