You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Kevin Jackson <fo...@gmail.com> on 2007/06/12 11:16:16 UTC

Task for substringing?

Hi all,

In the project I'm working on I have a need to be able to substring an
expanded property value

<property name="test" value="123">
<substring src="test" begin="1" end="2" property="new">
<echo>${new}</echo>

-> 23

Is there a way of achieving this already?  Looking through the manual
I don't see a way of doing this without using scriptdef + script
language du jour and for my current project I cannot use that.

If there currently isn't a way of achieving this, then I can put
something together for it (and get paid for it :)

Kev

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Task for substringing?

Posted by Dale Anson <da...@grafidog.com>.
Hi,

A little late, but Antelope has a StringUtils task that does 
substrings.  Maybe that would help with your situation?

Dale


Kevin Jackson wrote:
> Hi all,
>
>> > If there currently isn't a way of achieving this,
>> > then I can put
>> > something together for it (and get paid for it :)
>
> Well yesterday I was sick as a dog, but tuesday night I hacked
> together a very simple substring task (with antunit tests) on the
> off-chance that there wasn't a simple way of getting the result I was
> after...
>
>>   It seems like some combination of string resources,
>> tokens resource collections, and regex filters might
>> give you substringing capabilities.
>
> This was what I was thinking, but the combination seemed to be much
> more complex than writing a specialized task.
>
>>  Beyond that,
>> another idea that occurs to me is that, if you're
>> being paid to develop this... ;), PropertyHelpers have
>> been for quite some time in need of refinement as to
>> how a user can easily register a custom
>> PropertyHelper.  If we could ever get this off our
>> plate we could close e.g. the myriad requests for
>> nested property resolution.  How does this relate?  In
>> that it strikes me as a natural idea that there be a
>> custom PropertyHelper that implements the
>> substringing, defaulting, etc. extensions found in the
>> bash shell (probably came from some other shell but I
>> don't feel like researching the origin just to make my
>> point).
>>
>
> Hmm, I personally haven't looked at the PropertyHelper code very much
> (if at all).  I will have a dig around today and see what's happening
> in there.  As I was sick yesterday, I'm behind on my other tasks, so I
> may not be able to work on this until next week (if I get the go-ahead
> from the boss to do Ant coding).
>
> Thanks for the suggestion,
> Kev
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Task for substringing?

Posted by Kevin Jackson <fo...@gmail.com>.
Hi all,

> > If there currently isn't a way of achieving this,
> > then I can put
> > something together for it (and get paid for it :)

Well yesterday I was sick as a dog, but tuesday night I hacked
together a very simple substring task (with antunit tests) on the
off-chance that there wasn't a simple way of getting the result I was
after...

>   It seems like some combination of string resources,
> tokens resource collections, and regex filters might
> give you substringing capabilities.

This was what I was thinking, but the combination seemed to be much
more complex than writing a specialized task.

>  Beyond that,
> another idea that occurs to me is that, if you're
> being paid to develop this... ;), PropertyHelpers have
> been for quite some time in need of refinement as to
> how a user can easily register a custom
> PropertyHelper.  If we could ever get this off our
> plate we could close e.g. the myriad requests for
> nested property resolution.  How does this relate?  In
> that it strikes me as a natural idea that there be a
> custom PropertyHelper that implements the
> substringing, defaulting, etc. extensions found in the
> bash shell (probably came from some other shell but I
> don't feel like researching the origin just to make my
> point).
>

Hmm, I personally haven't looked at the PropertyHelper code very much
(if at all).  I will have a dig around today and see what's happening
in there.  As I was sick yesterday, I'm behind on my other tasks, so I
may not be able to work on this until next week (if I get the go-ahead
from the boss to do Ant coding).

Thanks for the suggestion,
Kev

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Task for substringing?

Posted by Matt Benson <gu...@yahoo.com>.
--- Kevin Jackson <fo...@gmail.com> wrote:

> Hi all,
> 
> In the project I'm working on I have a need to be
> able to substring an
> expanded property value
> 
> <property name="test" value="123">
> <substring src="test" begin="1" end="2"
> property="new">
> <echo>${new}</echo>
> 
> -> 23
> 
> Is there a way of achieving this already?  Looking
> through the manual
> I don't see a way of doing this without using
> scriptdef + script
> language du jour and for my current project I cannot
> use that.
> 
> If there currently isn't a way of achieving this,
> then I can put
> something together for it (and get paid for it :)

Hi Kev-
  It seems like some combination of string resources,
tokens resource collections, and regex filters might
give you substringing capabilities.  Beyond that,
another idea that occurs to me is that, if you're
being paid to develop this... ;), PropertyHelpers have
been for quite some time in need of refinement as to
how a user can easily register a custom
PropertyHelper.  If we could ever get this off our
plate we could close e.g. the myriad requests for
nested property resolution.  How does this relate?  In
that it strikes me as a natural idea that there be a
custom PropertyHelper that implements the
substringing, defaulting, etc. extensions found in the
bash shell (probably came from some other shell but I
don't feel like researching the origin just to make my
point).

HTH,
Matt


> 
> Kev
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 
> 



       
____________________________________________________________________________________
Get the free Yahoo! toolbar and rest assured with the added security of spyware protection.
http://new.toolbar.yahoo.com/toolbar/features/norton/index.php

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org