velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trad-ex <trad...@inter7.jp>
Subject How can I trimming $string ?
Date Fri, 19 May 2006 05:28:43 GMT
Hi all,

I have a question how to trim string smarter way.
My code is:

#macro( returnString $arg )
  ...do something
  $returnVal
#end

....

  #set( $somVal = "#returnString( $arg )" )
  
When I checked the contents of $someVal, it contained two leading space-
charachters and trailing \r\n.
So I should use trim() before I use $someVal value.
For instances,

 #if( $someVal.trim() == "SomeThing" )
 
My question is:
1. Is there smarter way to trim the white-spaces ?
2. What's wrong with my codes ?

Best Regards,
trad-ex


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message