首页>代码>SpringBoot+vue前后端分离-模板项目,适合新手小白二次开发,太香了>/EasyJavaTemplate/GenteratorCode/src/main/java/wujiangbo/tools/MyUtils.java
package wujiangbo.tools; /** * 工具类 * @author 波波老师(weixin:javabobo0513) */ public class MyUtils { public static void main(String[] args){ System.out.println(convert("t_", "t_user_demo")); } //单词所有下划线去掉,并且驼峰转换 public static String convert(String pre, String source) { StringBuffer sbf = new StringBuffer(); if (source.contains(pre)) { // 按下划线来切割字符串为数组 String[] split = source.split("_"); // 循环数组操作其中的字符串 for (int i = 1, index = split.length; i < index; i++){ String temp = split[i]; if(i == 1){ sbf.append(temp); }else{ sbf.append(temp.substring(0, 1).toUpperCase() + temp.substring(1)); } } }else{ sbf.append(source); } return sbf.toString(); } public static String getEntityName(String source) { StringBuffer sbf = new StringBuffer(); // 按下划线来切割字符串为数组 String[] split = source.split("_"); // 循环数组操作其中的字符串 for(int i=0; i<split.length; i++){ String word_temp = split[i]; if(i == 0){ sbf.append(word_temp); }else{ sbf.append(word_temp.substring(0, 1).toUpperCase() + word_temp.substring(1)); } } return sbf.toString(); } }

5418888 LV3
5月13日
quyan5632 LV2
2月10日
huasir2018 LV14
1月29日
AprilZk LV3
2024年12月12日
zolscy LV24
2024年11月26日
微信网友_7134912998903808 LV15
2024年8月29日
叁卍石 LV5
2024年8月21日
Oxygeni LV7
2024年7月14日
llllllK LV5
2024年5月13日
jc121140 LV3
2024年3月22日

梁小贤 LV1
5月22日
5418888 LV3
5月13日
daqfrq332
4月7日
暂无贡献等级
微信网友_6497953430949888 LV1
3月14日
PLVAE_514 LV2
3月7日
yuanshun LV7
2月18日
huangzhijing
2月11日
暂无贡献等级
quyan5632 LV2
2月10日
YYY_xxx_
2月5日
暂无贡献等级
huasir2018 LV14
1月29日