Description
The CollapseWhiteSpace
method is a static extension method provided by the SandboxSystemExtensions
class. It is used to process a string by collapsing consecutive whitespace characters into a single space. This can be useful for normalizing text input where multiple spaces, tabs, or newlines should be reduced to a single space for consistency.
Usage
To use the CollapseWhiteSpace
method, simply call it on any string instance. This method is an extension method, so it can be called as if it were a method on the string
class itself.
Example usage:
string input = "This is a test string.";
string result = input.CollapseWhiteSpace();
// result: "This is a test string."
Example
string input = "This is a test string.";
string result = input.CollapseWhiteSpace();
// result: "This is a test string."