Skip to content

StringUtils.normalizeSpace

Signature: StringUtils.normalizeSpace(inputString)

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

Removes whitespace from both ends of the string and then replaces sequences of whitespace characters with a single space.

Parameters

Type Name Description Default
String inputString a String or null

Example

var normalizedSpacing = StringUtils.normalizeSpace('  This is wonky     with \t\t wild spacing    .'); //  This is wonky with wild spacing .