首页>代码>javabean+servlet+jsp开发商品后台管理系统(源码+数据库脚本)>/JavaWebProject_v1.0/src/com/yueqian/project/common/StringTools.java
package com.yueqian.project.common; import java.util.regex.Matcher; import java.util.regex.Pattern; public class StringTools { private static Pattern linePattern = Pattern.compile("_(\\w)"); private static Pattern humpPattern = Pattern.compile("[A-Z]"); /** * 驼峰转下划线,最后转为大写 * @param str * @return */ public static String humpToLine(String str) { Matcher matcher = humpPattern.matcher(str); StringBuffer sb = new StringBuffer(); while (matcher.find()) { matcher.appendReplacement(sb, "_" + matcher.group(0).toUpperCase()); } matcher.appendTail(sb); return sb.toString().toUpperCase(); } /** * 下划线转驼峰,正常输出 * @param str * @return */ public static String lineToHump(String str) { Matcher matcher = linePattern.matcher(str.toLowerCase()); StringBuffer sb = new StringBuffer(); while (matcher.find()) { matcher.appendReplacement(sb, matcher.group(1).toUpperCase()); } matcher.appendTail(sb); return sb.toString(); } /** * 处理null,将null的数据转为str * @param str * @return */ public static String nullToStr(String str){ if(str==null){ return ""; } return str; } }

微信网友_7577830620712960 LV2
7月1日
15532048877 LV1
6月19日
穿山甲1001 LV6
2024年9月7日
TY0165 LV20
2024年6月18日
aholian LV2
2024年6月13日
HangEcho LV2
2024年6月5日
sz1111111 LV2
2024年3月26日
PSSDZH LV3
2024年1月22日
aaasue LV1
2024年1月4日
luoqingyun LV1
2023年12月31日

微信网友_7577830620712960 LV2
7月1日
微信网友_7562058687860736
6月20日
暂无贡献等级
15532048877 LV1
6月19日
blzzza
6月16日
暂无贡献等级
微信网友_7555743612866560
6月15日
暂无贡献等级
wmmmmmm
6月14日
暂无贡献等级
歪比歪比
5月27日
暂无贡献等级
luoyun123
5月11日
暂无贡献等级
wwy000 LV2
4月29日
1138504729
4月13日
暂无贡献等级