Skip to content

StringUtils.trim

Signature: StringUtils.trim(inputString)

Returns: String result - the trimmed string, or null if inputString is null

Removes spaces (control characters <= 32) from both ends of the inputString, handling null by returning null.

Parameters

Type Name Description Default
String inputString the String to be trimmed, may be null

Example

StringUtils.trim(" \t\tThis is a test!        \r\n"); // This is a test!