ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: String manipulation
Date Tue, 22 Jan 2002 19:44:10 GMT
--- Sugandha Shah <sugandhas@cybage.com> wrote:
> Is it possible to do following task with Ant.
> 
> jdbc.driver.properties=user=xyz;password=abc ;maxconn=10"
> 
> Now in the build .xml I require  them  as separate parameters
> 
>  i.e user =xyz
> 
> password=abc
> 
> maxconn=10
> 
> So is there any task which behaves like string tokenizer.

I don't know of any task currently available, but you could use the
<script> task.

You didn't say what you wanted to do with the params once you've separated
them, but here's a simple example that just echo's them out:

  <property name="jdbc.driver.properties"
            value="user=xyz;password=abc;maxconn=10"/>

  <target name="doParams">
    <antcall target="tokenize">
      <param name="params" value="${jdbc.driver.properties}"/>
    </antcall>
  </target>

  <target name="tokenize">
    <script language="javascript"> <![CDATA[
      importClass(java.util.StringTokenizer);
      params = new StringTokenizer(projname.getProperty("params"), ";");
      while (params.hasMoreTokens()) {
        param = params.nextToken();
        showit = projname.createTask("echo");
        showit.setMessage(param);
        showit.execute();
      }
    ]]> </script>
  </target>

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message