Georg-Johann Lay schrieb:

Ant proper really is not capable to perform things that look in C like

 >> char * prefix;
 >> char * path;
 >> char * suffix = path + strlen (prefix);

or like

 >> String prefix;
 >> String path;
 >> String suffix = path.substring (prefix.length());

in Java?

Hi, I found this solution:

    <!-- remove prefix from path -->
    <tempfile property="prefix.file" />
    <echo message="${path}" file="${prefix.file}" />
    <length property="prefix.length" string="${prefix}" />
<replaceregexp file="${prefix.file}" match="^.{${prefix.length}}(.*)" replace="path.suffix=\1" />
    <property file="${prefix.file}" />
    <delete file="${prefix.file}" deleteonexit="true" />

    <echo message="path.suffix=${path.suffix} via ${prefix.file}" />

What I don't like are the accesses to the file system.
Can they be avoided?

You ant experts certanly know smarter ways to do this :-)

Regards, Georg-Johann


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to