title | description | author | tags |
---|---|---|---|
snake_case to camelCase |
Converts a snake_case string into camelCase |
Mcbencrafter |
string,conversion,camel-case,snake-case |
import java.util.regex.Pattern;
public static String snakeToCamel(String snakeCase) {
return Pattern.compile("(_)([a-z])")
.matcher(snakeCase)
.replaceAll(match -> match.group(2).toUpperCase());
}
// Usage:
System.out.println(snakeToCamel("hello_world")); // "helloWorld"