Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to change lowercase_underscore string to camelCase

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

my_name -> myName 

Is there any library or something to help this out?

like image 738
Deckard Avatar asked Jun 12 '13 08:06

Deckard


People also ask

How do you change a string into a upper case?

upper() Return Value upper() method returns the uppercase string from the given string. It converts all lowercase characters to uppercase.


1 Answers

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

CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "my_name") 
like image 55
gma Avatar answered Sep 19 '22 02:09

gma