String - Change Case

A useful method if you are obtaining a variable from the querystring and are worried that its been typed in the wrong format.

You can also use the css syntax text-transform with any of the following values: none, capitalize - (first character of each word is uppercase), uppercase, lowercase, inherit.

  1. ## Retrieve value from the querystring  
  2. #set ($example = $request.getParameter('example-string-value') )  
  4. #set ($example = "AmEriCA")  
  6. ## Output AMERICA  
  7. $example.toUpperCase()  
  9. ## Output america  
  10. $example.toLowerCase()  
comments powered by Disqus