Package com.impossibl.postgres.utils
Class StringTransforms
- java.lang.Object
-
- com.impossibl.postgres.utils.StringTransforms
-
public class StringTransforms extends Object
-
-
Constructor Summary
Constructors Constructor Description StringTransforms()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
capitalize(String val)
static String
capitalizeGroups(String val, boolean capitalizeFirstWord)
static String
dashedFromCamelCase(String val)
"un"-capitalizes a string in lowerCamelCase or UpperCamelCase to all lowercase separated by dashes.static String
dashedFromSnakeCase(String val)
"un"-capitalizes a string in UPPER_SNAKE_CASE to all lowercase separated by dashes.static String
dottedFromCamelCase(String val)
"un"-capitalizes a string in lowerCamelCase or UpperCamelCase to all lowercase separated by dots.static String
fromCamelCase(String val, char separator)
"un"-capitalizes a string in lowerCamelCase or UpperCamelCase to all lowercase separated by the providedseparator
.static String
fromSnakeCase(String val, char separator)
"un"-capitalizes a string in UPPER_SNAKE_CASE to all lowercase separated by the providedseparator
.static String
toLowerCamelCase(String val)
Attempt to transform the given value into a "lowerCamelCase" version of the same string.static String
toUpperCamelCase(String val)
Attempt to transform the given value into an "UpperCamelCase" version of the same string.static String
toUpperSnakeCase(String val)
Attempt to transform the given value into an "UPPER_SNAKE_CASE" version of the same string.
-
-
-
Method Detail
-
dashedFromCamelCase
public static String dashedFromCamelCase(String val)
"un"-capitalizes a string in lowerCamelCase or UpperCamelCase to all lowercase separated by dashes.- Parameters:
val
- Value to un-capitalize- Returns:
- Un-capitalized version
-
dottedFromCamelCase
public static String dottedFromCamelCase(String val)
"un"-capitalizes a string in lowerCamelCase or UpperCamelCase to all lowercase separated by dots.- Parameters:
val
- Value to un-capitalize- Returns:
- Un-capitalized version
-
fromCamelCase
public static String fromCamelCase(String val, char separator)
"un"-capitalizes a string in lowerCamelCase or UpperCamelCase to all lowercase separated by the providedseparator
.- Parameters:
val
- Value to un-capitalizeseparator
- Word separator- Returns:
- Un-capitalized version
-
dashedFromSnakeCase
public static String dashedFromSnakeCase(String val)
"un"-capitalizes a string in UPPER_SNAKE_CASE to all lowercase separated by dashes.- Parameters:
val
- Value to un-capitalize- Returns:
- Un-capitalized version
-
fromSnakeCase
public static String fromSnakeCase(String val, char separator)
"un"-capitalizes a string in UPPER_SNAKE_CASE to all lowercase separated by the providedseparator
.- Parameters:
val
- Value to un-capitalizeseparator
- Word separator- Returns:
- Un-capitalized version
-
toUpperSnakeCase
public static String toUpperSnakeCase(String val)
Attempt to transform the given value into an "UPPER_SNAKE_CASE" version of the same string. Notably this replaces dots, dashes & spaces with underscores.- Parameters:
val
- Value to transform- Returns:
UPPER_SNAKE_CASE
version of string.
-
toUpperCamelCase
public static String toUpperCamelCase(String val)
Attempt to transform the given value into an "UpperCamelCase" version of the same string. Notably this erases dots, dashes, underscores & spaces as it counts them as word breaks.- Parameters:
val
- Value to transform- Returns:
UpperCamelCase
version of string.
-
toLowerCamelCase
public static String toLowerCamelCase(String val)
Attempt to transform the given value into a "lowerCamelCase" version of the same string. Notably this erases dots, dashes, underscores & spaces as it counts them as word breaks.- Parameters:
val
- Value to transform- Returns:
lowerCamelCase
version of the string.
-
-