1

We often have the situation, that string values start with a whitespace. How can I check and return all strings which start with a whitespace?

I found a similar question: Velocity, what's the most efficient way to check if a string is empty and not null

But I don't know how to exactly do it, as I have never done anything with Velocity before.

SteffPoint
  • 479
  • 2
  • 9
  • 24

1 Answers1

1

Don't forget that you can call Java methods on Velocity references. So nothing stops you from doing:

#foreach($str in $myStrings)
  #if($str.startsWith(' '))
    ## do something with $str
  #end
#end
Claude Brisson
  • 4,085
  • 1
  • 22
  • 30