CamelCaseString to Space Separated String

groovy> print 'CamelCaseString'.replaceAll(/([A-Z][a-z]*)/, '$1 ').trim()Camel Case String

There is probably a better regex approach that does not a space to the final word, and thus remove the need for a trim, but this is quick and easily embeddable anywhere, for example, in a jasper report groovy expression. Winking smile

Bookmark and Share

Related posts:

  1. Lessons in Jasper (i)Reports
  2. Some Groovy Little Tips
  3. Scratch your Groovy itch on the web
  4. So you like Graphs, Groovy and Monitoring
  5. Groovy for Java Devs
This entry was posted in Code Snippets, Groovy and tagged , , , . Bookmark the permalink.

Leave a Reply