Class CaseConverterUtils
public class for converting strings between various naming conventions:
camelCase, PascalCase, snake_case, kebab-case, UPPER_SNAKE_CASE, Train-Case, flatcase, and COBOL-CASE.
Key Methods:
toCamelCase(String)- Converts input to camelCase.toPascalCase(String)- Converts input to PascalCase.toSnakeCase(String)- Converts input to snake_case.toKebabCase(String)- Converts input to kebab-case.toUpperSnakeCase(String)- Converts input to UPPER_SNAKE_CASE.toTrainCase(String)- Converts input to Train-Case.toFlatcase(String)- Converts input to flatcase.toCobolCase(String)- Converts input to COBOL-CASE.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringtoCamelCase(String pInput) static StringtoCobolCase(String pInput) static StringtoFlatcase(String pInput) static StringtoKebabCase(String pInput) static StringtoPascalCase(String pInput) static StringtoSnakeCase(String pInput) static StringtoTrainCase(String pInput) static StringtoUpperSnakeCase(String pInput)
-
Method Details
-
toCamelCase
AStringthat converts a givenStringto camelCase.If the input is in PascalCase, snake_case, or kebab-case, it will be converted accordingly.
- Parameters:
pInput-String- The input string to be converted.- Returns:
- The camelCase version of the input string.
- Since:
- 1.0.0
-
toPascalCase
AStringthat converts a givenStringto PascalCase.If the input is in camelCase, snake_case, or kebab-case, it will be converted accordingly.
- Parameters:
pInput-String- The input string to be converted.- Returns:
- The PascalCase version of the input string.
- Since:
- 1.0.0
-
toSnakeCase
AStringthat converts a givenStringto snake_case.It converts camelCase, PascalCase, and kebab-case to snake_case by adding underscores where appropriate.
- Parameters:
pInput-String- The input string to be converted.- Returns:
- The snake_case version of the input string.
- Since:
- 1.0.0
-
toKebabCase
AStringthat converts a givenStringto kebab-case.It converts camelCase, PascalCase, and snake_case to kebab-case by adding hyphens where appropriate.
- Parameters:
pInput-String- The input string to be converted.- Returns:
- The kebab-case version of the input string.
- Since:
- 1.0.0
-
toUpperSnakeCase
AStringthat converts a givenStringto UPPER_SNAKE_CASE.Converts camelCase, PascalCase, snake_case, and kebab-case to UPPER_SNAKE_CASE by adding underscores and converting all letters to uppercase.
- Parameters:
pInput-String- The input string to be converted.- Returns:
- The UPPER_SNAKE_CASE version of the input string.
- Since:
- 1.0.0
-
toTrainCase
AStringthat converts a givenStringto Train-Case.Converts camelCase, PascalCase, snake_case, and kebab-case to Train-Case by adding hyphens and capitalizing each word.
- Parameters:
pInput-String- The input string to be converted.- Returns:
- The Train-Case version of the input string.
- Since:
- 1.0.0
-
toFlatcase
AStringthat converts a givenStringto flatcase.Converts all cases to flatcase by removing any delimiters and converting to lowercase.
- Parameters:
pInput-String- The input string to be converted.- Returns:
- The flatcase version of the input string.
- Since:
- 1.0.0
-
toCobolCase
AStringthat converts a givenStringto COBOL-CASE.Converts camelCase, PascalCase, snake_case, and kebab-case to COBOL-CASE by making all letters uppercase and replacing spaces with hyphens.
- Parameters:
pInput-String- The input string to be converted.- Returns:
- The COBOL-CASE version of the input string.
- Since:
- 1.0.0
-