What is the simplest way to convert a Java string from all caps (words separated by underscores) to CamelCase (no word separators)?

Another option is using Google Guava’s com.google.common.base.CaseFormat

George Hawkins left a comment with this example of usage:

CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, "THIS_IS_AN_EXAMPLE_STRING");

Leave a Comment