Collapses multiple consecutive whitespace characters in a string into a single space and trims leading and trailing whitespace.
The input string.
The normalized string with collapsed whitespace.
1.1.0
collapseWhitespace(" Hello World "); // "Hello World"collapseWhitespace("Line\nBreak\tTest"); // "Line Break Test" Copy
collapseWhitespace(" Hello World "); // "Hello World"collapseWhitespace("Line\nBreak\tTest"); // "Line Break Test"
Collapses multiple consecutive whitespace characters in a string into a single space and trims leading and trailing whitespace.