Class TrimSanitizer
java.lang.Object
io.github.rabinarayanpatra.sanitizer.builtin.TrimSanitizer
- All Implemented Interfaces:
FieldSanitizer<String>
Sanitizer that trims leading and trailing whitespace from the input string.
Commonly used to normalize user input such as names, emails, or free-text fields before storage or validation.
String input = " example@example.com ";
String sanitized = new TrimSanitizer().sanitize(input); // "example@example.com"
- Since:
- 1.0.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
TrimSanitizer
public TrimSanitizer()Default constructor.
-
-
Method Details
-
sanitize
Trims whitespace from both ends of the input string.- Specified by:
sanitizein interfaceFieldSanitizer<String>- Parameters:
input- the string to sanitize- Returns:
- the trimmed string, or
nullif input isnull
-