Dim text = "My name is Anas Fares"
Dim newText = System.Text.RegularExpressions.Regex.Replace(text, "[ ]{2,}", " ")
Run Code Online (Sandbox Code Playgroud)
或者这个如果你想摆脱TABS,NEWLINES等等.
Dim text = "My name is " & Environment.NewLine & " Anas Fares"
Dim newText = System.Text.RegularExpressions.Regex.Replace(text, "\s+", " ")
Run Code Online (Sandbox Code Playgroud)