Class CaseFormatUtils
- java.lang.Object
-
- org.assertj.core.util.introspection.CaseFormatUtils
-
public class CaseFormatUtils extends java.lang.Object
Utility class for conversion between different case formats
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
WORD_SEPARATOR_REGEX
-
Constructor Summary
Constructors Modifier Constructor Description private
CaseFormatUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.String
adjustWordCase(java.lang.String s, boolean firstLetterUpperCased)
private static java.util.List<java.lang.String>
extractWords(java.lang.String s)
private static boolean
isAllCaps(java.lang.String s)
static java.lang.String
toCamelCase(java.lang.String s)
Converts an input string into camelCase.
-
-
-
Field Detail
-
WORD_SEPARATOR_REGEX
private static final java.lang.String WORD_SEPARATOR_REGEX
- See Also:
- Constant Field Values
-
-
Method Detail
-
toCamelCase
public static java.lang.String toCamelCase(java.lang.String s)
Converts an input string into camelCase.The input string may use any of the well known case styles: Pascal, Snake, Kebab or even Camel. Already camelCased strings will be returned as is. Mix and match is also an option; the algorithm will try its best to give an acceptable answer. Mixed case will be preserved, i.e
assertThat(toCamelCase("miXedCAse")).isEqualTo("miXedCAse")
- Parameters:
s
- the string to be converted- Returns:
- the input string converted to camelCase
-
extractWords
private static java.util.List<java.lang.String> extractWords(java.lang.String s)
-
adjustWordCase
private static java.lang.String adjustWordCase(java.lang.String s, boolean firstLetterUpperCased)
-
isAllCaps
private static boolean isAllCaps(java.lang.String s)
-
-