[antlr-interest] String Template - doing a substring?

Nick Lee (NWL Solutions Limited) nick.lee at nwlsolutions.com
Thu Aug 23 02:09:46 PDT 2007


Hi all,

I'm using the c# String Template and it seems a fantastic powerful piece of
software, which I'm sure I have only scratched the surface on.

 

I've got a very simple template where I would like to check the length of an
attribute passed (easily done using the c# strings length property). However
if this length is over a specified amount I would like to substring the
value.

 

I've looked at the docs and examples but cannot find how to call the sc#
string substring method etc, does anybody have any examples of comparing the
length of a string and then doing a substring?

 

For example .

$if(obj.description.Length()>20)$

obj.description.substring(0,20)

$else$

obj.description

$endif$

 

Any guidance is much appreciated.

 

Kind regards,

Nick

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070823/6dfb9936/attachment.html 


More information about the antlr-interest mailing list