public static String convertToUnderscore(String camelCase) {
return camelCase.replaceAll(
"([a-z])([A-Z]+)",
"$1_$2"
).toLowerCase();
}
public static void main(String[] args) {
String camelCase = "ktCollectType";
String underscore = convertToUnderscore(camelCase);
System.out.println(underscore); // 输出: kt_collect_type
}