StringUtils - 字符串处理
判空
StringUtils.isEmpty(str); // null 或 ""
StringUtils.isNotEmpty(str);
StringUtils.isBlank(str); // null 或 空白字符
StringUtils.isNotBlank(str);
StringUtils.isAnyEmpty(str1, str2);
格式化
StringUtils.formatMsg("Hello {}, welcome to {}", name, site); // {} 占位符
StringUtils.formatMsg("Value {0} is {1}", "name", "John"); // 索引占位符
// JSONMap 模板替换
JSONMap params = new JSONMap("name", "John", "age", "30");
StringUtils.formatMsg("Hello ${name}, you are ${age} years old", params);
// → "Hello John, you are 30 years old"
拼接
StringUtils.join(",", "a", "b", "c"); // "a,b,c"
StringUtils.join(list, ",");
判断
StringUtils.isNumber("123.45"); // true(数值格式校验)
StringUtils.isLongOrInt("123"); // true
StringUtils.startsWith("hello", "hel"); // true
转换
StringUtils.capitalize("hello"); // "Hello"
StringUtils.addZeroBefor(42, 5); // "00042"
StringUtils.leftPad("text", 10, '0'); // "000000text"
Bean ID 生成
StringUtils.getBeanId("com.example.UserService"); // "userService"
StringUtils.getBeanId(UserService.class); // "userService"