|
@@ -129,6 +129,20 @@ public class StringUtil {
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
+ private static Pattern linePattern = Pattern.compile("_(\\w)");
|
|
|
+
|
|
|
+
|
|
|
+ public static String lineToHump(String str) {
|
|
|
+ str = str.toLowerCase();
|
|
|
+ Matcher matcher = linePattern.matcher(str);
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ while (matcher.find()) {
|
|
|
+ matcher.appendReplacement(sb, matcher.group(1).toUpperCase());
|
|
|
+ }
|
|
|
+ matcher.appendTail(sb);
|
|
|
+ return sb.toString();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 分割字符串,如果开始位置大于字符串长度,返回空
|