private static Pattern humpPattern = Pattern.compile("[A-Z]");
// 将驼峰命名转为下划线名称
public static String humpToLine(String str) {
Matcher matcher = humpPattern.matcher(str);
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
matcher.appendReplacement(sb, "_" + matcher.group(0).toLowerCase());
}
matcher.appendTail(sb);
return sb.toString();
}
原创文章,作者:254126420,如若转载,请注明出处:https://blog.ytso.com/245718.html