数据库下划线转驼峰方法

private static String humpToLine2(String str) {
        str = str.toLowerCase();
        final StringBuffer sb = new StringBuffer();
        Pattern p = Pattern.compile("_(\\w)");
        Matcher m = p.matcher(str);
        while (m.find()) {
            m.appendReplacement(sb, m.group(1).toUpperCase());
        }
        m.appendTail(sb);
        return sb.toString();
    }

 

posted @ 2020-12-28 10:48  静默之尘  阅读(427)  评论(0)    收藏  举报