public class NamingCase extends Object
Constructor and Description |
---|
NamingCase() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isLowerCase(CharSequence str)
给定字符串中的字母是否全部为小写,判断依据如下:
1.
|
static boolean |
isUpperCase(CharSequence str)
给定字符串中的字母是否全部为大写,判断依据如下:
1.
|
static String |
swapCase(String str)
切换给定字符串中的大小写。
|
static String |
toCamelCase(CharSequence name)
将下划线方式命名的字符串转换为驼峰式。
|
static String |
toCamelCase(CharSequence name,
char symbol)
将连接符方式命名的字符串转换为驼峰式。
|
static String |
toCamelCase(CharSequence name,
char symbol,
boolean otherCharToLower)
将连接符方式命名的字符串转换为驼峰式。
|
static String |
toKebabCase(CharSequence str)
将驼峰式命名的字符串转换为短横连接方式。
|
static String |
toPascalCase(CharSequence name)
将下划线方式命名的字符串转换为帕斯卡式。
|
static String |
toSymbolCase(CharSequence str,
char symbol)
将驼峰式命名的字符串转换为使用符号连接方式。
|
static String |
toUnderlineCase(CharSequence str)
将驼峰式命名的字符串转换为下划线方式,又称SnakeCase、underScoreCase。
|
public static String toUnderlineCase(CharSequence str)
HelloWorld=》hello_world Hello_World=》hello_world HelloWorld_test=》hello_world_test
str
- 转换前的驼峰式命名的字符串,也可以为下划线形式public static String toKebabCase(CharSequence str)
HelloWorld=》hello-world Hello_World=》hello-world HelloWorld_test=》hello-world-test
str
- 转换前的驼峰式命名的字符串,也可以为下划线形式public static String toSymbolCase(CharSequence str, char symbol)
str
- 转换前的驼峰式命名的字符串,也可以为符号连接形式symbol
- 连接符public static String toPascalCase(CharSequence name)
name
- 转换前的下划线大写方式命名的字符串public static String toCamelCase(CharSequence name)
name
- 转换前的下划线大写方式命名的字符串public static String toCamelCase(CharSequence name, char symbol)
name
- 转换前的自定义方式命名的字符串symbol
- 原字符串中的连接符连接符public static String toCamelCase(CharSequence name, char symbol, boolean otherCharToLower)
true
时,分为以下情况:
name
- 转换前的自定义方式命名的字符串symbol
- 原字符串中的连接符连接符otherCharToLower
- 其他非连接符后的字符是否需要转为小写public static boolean isUpperCase(CharSequence str)
1. 大写字母包括A-Z 2. 其它非字母的Unicode符都算作大写
str
- 被检查的字符串public static boolean isLowerCase(CharSequence str)
1. 小写字母包括a-z 2. 其它非字母的Unicode符都算作小写
str
- 被检查的字符串Copyright © 2025. All rights reserved.