Tips and tricks for .NET using ASP and VB code.

Remove extra spaces and tabs from a string of characters.

Dim TextWithExtraSpaces As String = "The    Quick   Brown   Fox    Jumps    Over          A           Lazy Dog."
Dim TextWithExtraSpacesRemoved As String = System.Text.RegularExpressions.Regex.Replace(TextWithExtraSpaces, "\s+", " ")

No comments:

Post a Comment

Search This Blog