Allnoch Gerlinde wrote:
Hello,
i am looking for something like:
#set ($thema = ereg_replace('# ', '', $thema))
#set ($thema = ereg_replace('# ', '', $thema))
#set ($thema = ereg_replace('#', '', $thema))
How is it possible to do this ?
If you are running on a JDK 1.4 VM try:
#set( $thema = $thema.replaceAll('# ? ?', '') )
Other regular expression patterns might be more suitable, but
this does the same as your three lines above...
See more on String.replaceAll and Pattern in the API docs at:
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#replaceAll(java.lang.String,%20java.lang.String)
http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
You could pack this into a veloci-macro,
#macro( ereg_replace $from $to $string )$string.replaceAll( $from, $to )#end
...
#set( $thema = "#ereg_replace('# ', '', $thema)" )
but IMHO the replaceAll is so straightforward packing it into
a macro is an overkill.
Cheers,
Christoph
Regards,
Gerlinde Allnoch
Universit�t Hohenheim
Abteilung 1.2 EDV in der Verwaltung
Germany
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]