You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.5 KiB
58 lines
1.5 KiB
package com.dsideal.Utils;
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
public class dsKit {
|
|
/**
|
|
* 功能:获取当前时间
|
|
* @return
|
|
*/
|
|
public static String getCurrentTimeStr() {
|
|
return DateUtil.formatDateTime(DateUtil.date());
|
|
}
|
|
|
|
/**
|
|
* 功能:输出消息,并且附带当前时间
|
|
* @param msg
|
|
*/
|
|
public static void print(String msg){
|
|
System.out.println(getCurrentTimeStr()+" "+msg);
|
|
}
|
|
|
|
/**
|
|
* 功能:首字母转大写
|
|
*
|
|
* @param input
|
|
* @return
|
|
*/
|
|
public static String capitalizeFirstLetter(String input) {
|
|
// 检查输入是否为空或者null
|
|
if (input == null || input.isEmpty()) {
|
|
return input;
|
|
}
|
|
|
|
// 将第一个字符转换为大写,然后与其余部分拼接
|
|
return input.substring(0, 1).toUpperCase() + input.substring(1);
|
|
}
|
|
|
|
/**
|
|
* 将表名转换为驼峰命名法
|
|
*/
|
|
public static String toCamelCase(String tableName) {
|
|
StringBuilder sb = new StringBuilder();
|
|
boolean upperCase = false;
|
|
|
|
for (char c : tableName.toCharArray()) {
|
|
if (c == '_') {
|
|
upperCase = true;
|
|
} else if (upperCase) {
|
|
sb.append(Character.toUpperCase(c));
|
|
upperCase = false;
|
|
} else {
|
|
sb.append(c);
|
|
}
|
|
}
|
|
return sb.toString();
|
|
}
|
|
}
|