public class NamingCase extends Object
| Constructor and Description |
|---|
NamingCase() |
| Modifier and Type | Method and Description |
|---|---|
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)
name - 转换前的自定义方式命名的字符串symbol - 原字符串中的连接符连接符otherCharToLower - 其他非连接符后的字符是否需要转为小写Copyright © 2025. All rights reserved.