Need to change lowercase_underscore string to camelCase

Deckard picture Deckard · Jun 12, 2013 · Viewed 15.7k times · Source

I Need to change String : underbar + lowercase = uppercase.(and the opposite)

my_name -> myName

Is there any library or something to help this out?

Answer

gma picture gma · Jun 12, 2013

You can use the CaseFormat class's LOWER_UNDERSCORE from google Guava :

CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "my_name")