首页>代码>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(); } }
最近下载更多
jc121140 LV3
3月22日
wanglinddad LV55
3月14日
welcome丶 LV8
3月7日
全栈小陈 LV4
1月21日
oulingqiao LV13
1月11日
root111snkdnc LV3
2023年12月27日
123854216 LV5
2023年12月16日
ljfydm LV2
2023年10月15日
huhansan LV10
2023年10月13日
lkx666 LV3
2023年10月10日
最近浏览更多
飃go with wind
5月7日
暂无贡献等级
来一杯西瓜冰咩 LV1
5月6日
kenhomeliu LV29
4月30日
win nas
4月28日
暂无贡献等级
2775645521 LV5
4月23日
不想起 LV10
4月22日
做自己的太阳 LV11
4月17日
zhangtian1997 LV10
4月15日
strongning LV3
4月5日
玖零定制问题修复 LV34
4月4日