Top Description Fields Constructors Methods
org.assertj.core.util.introspection

public Class CaseFormatUtils

extends Object
Class Inheritance
Static Imports
java.util.Objects.requireNonNull, java.util.stream.Collectors.joining, .Collectors.toList

Utility class for conversion between different case formats

Field Summary

Modifier and TypeField and Description
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static String
adjustWordCase(String s, boolean firstLetterUpperCased)

private static List<String>
private static boolean
public static String

Returns:

the input string converted to camelCase
toCamelCase
(String
the string to be converted
s
)

Converts an input string into camelCase.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

WORD_SEPARATOR_REGEXback to summary
private static final String WORD_SEPARATOR_REGEX

Constructor Detail

CaseFormatUtilsback to summary
private CaseFormatUtils()

Method Detail

adjustWordCaseback to summary
private static String adjustWordCase(String s, boolean firstLetterUpperCased)
extractWordsback to summary
private static List<String> extractWords(String s)
isAllCapsback to summary
private static boolean isAllCaps(String s)
toCamelCaseback to summary
public static String toCamelCase(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:String

the string to be converted

Returns:String

the input string converted to camelCase