What is the most elegant way to convert a hyphen separated word (e.g. “do-some-stuff”) to the lower camel-case variation (e.g. “doSomeStuff”)?

Use CaseFormat from Guava:

import static com.google.common.base.CaseFormat.*;

String result = LOWER_HYPHEN.to(LOWER_CAMEL, "do-some-stuff");

Leave a Comment