dim a as string = " wilcome to sa WeCame "
期望的结果:
"Wilcome to sa WeCame"
最佳答案
您可以使用System.Text.RegularExpressions.Regex.Replace
Dim a As String = " wilcome to sa WeCame "
Dim cleanedString As String = Regex.Replace(a, "\s{2,}", " ").Trim()
关于c# - 如何清除字符串中的重复空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21933320/