Pattern pattern = Pattern.compile("\\B(\\p{Upper})(\\p{Lower}*)");
Matcher matcher = pattern.matcher("longAndLongCity");
String replaceAll = matcher.replaceAll("_$1$2");
String result = replaceAll.toLowerCase() // 不是很优美
System.out.println(result);
java驼峰转下划线
最新推荐文章于 2024-09-27 16:09:04 发布