Class SentenceCaseSanitizer
java.lang.Object
io.github.rabinarayanpatra.sanitizer.builtin.SentenceCaseSanitizer
- All Implemented Interfaces:
FieldSanitizer<String>
Sanitizer that converts the input string to sentence case by capitalizing
only the first character and lowercasing the rest.
Leading and trailing whitespace is trimmed first. If the input is
null or blank, it is returned as-is.
String input = " heLLo WoRLd ";
String sanitized = new SentenceCaseSanitizer().sanitize(input); // "Hello world"
- Since:
- 1.1.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
SentenceCaseSanitizer
public SentenceCaseSanitizer()Default constructor.
-
-
Method Details
-
sanitize
Converts a trimmed string to sentence case (capitalizes the first letter, lowercases the rest).- Specified by:
sanitizein interfaceFieldSanitizer<String>- Parameters:
input- the string to sanitize- Returns:
- the sentence-cased string, or the original input if it is
nullor blank
-