--- Barry Jia <[EMAIL PROTECTED]> wrote:
> for example, I define a property file.name, value is xxxx.java, how
> could I to get the sub string xxxx from that value in ant scripts?

If you've got 'basename' on all the machines you run your build on:
  <target name="runBasename">
    <exec executable="basename" outputproperty="basename">
      <arg line="${file.name} .java"/>
    </exec>
    <echo message="basename = ${basename}"/>
  </target>

Otherwise, you could use the <script> task:
  <target name="getBasename" depends="genBasename">
    <echo message="basename = ${basename}"/>
  </target>
  <target name="genBasename">
    <script language="javascript"> <![CDATA[
      importClass(java.io.File);
      file = new File(projname.getProperty("file.name"));
      basename = file.getName();
      pos = basename.indexOf('.');
      basename = basename.substring(0, pos);
      projname.setProperty("basename", basename);
      ]]>
    </script>
  </target>

Or you could write a task to do it.

Diane

=====
([EMAIL PROTECTED])



__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to