Topic Transformation ExtensionsNormalize White Space Method
Normalize whitespace in a string by replacing consecutive runs of whitespace with a single space
and removing leading and trailing whitespace.
Definition
Namespace: Sandcastle.Core.PresentationStyle.Transformation
Assembly: Sandcastle.Core (in Sandcastle.Core.dll) Version: 2026.1.20.0
The normalized string
Assembly: Sandcastle.Core (in Sandcastle.Core.dll) Version: 2026.1.20.0
C#
public static string NormalizeWhiteSpace(
this string text
)VB
<ExtensionAttribute>
Public Shared Function NormalizeWhiteSpace (
text As String
) As StringC++
public:
[ExtensionAttribute]
static String^ NormalizeWhiteSpace(
String^ text
)F#
[<ExtensionAttribute>]
static member NormalizeWhiteSpace :
text : string -> string Parameters
- text String
- The text to normalize
Return Value
StringThe normalized string
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type String. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Remarks
This is based on the normalize-space() XSLT function implementation in the .NET Framework