Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails convert string to letter case

Tags:

grails

groovy

I need to convert string to letter case (proper case or title case), is there any default function on Groovy support for this or I need to manual sub string convert first character?

like image 726
Kuc Ku Avatar asked Nov 30 '22 01:11

Kuc Ku


1 Answers

assert org.apache.commons.lang.WordUtils.capitalizeFully('man OF stEEL') == 'Man Of Steel'

The WordUtils class is provided by Apache Commons Lang, which is available on the classpath of Grails apps by defatult

like image 74
Dónal Avatar answered Dec 08 '22 06:12

Dónal