驼峰转下划线

/**
* 驼峰转下划线
*/
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();
}
posted @ 2021-11-16 15:36  游走人间的蒲公英  阅读(39)  评论(0编辑  收藏  举报