Search code examples
javacase-sensitive

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?


Solution

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

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