资源
Public Function NoWhiteSpace(ByVal strText As String) As String
Return System.Text.RegularExpressions.Regex.Replace(strText, " ", _
String.Empty, System.Text.RegularExpressions.RegexOptions.IgnoreCase)
End Function
演示版
Dim Test As String = " This is a simple test for No white spaces function "
Console.WriteLine("The original text is [{0}] and the replacement is [{1}]", _
Test, RemoveWhiteSpace(Test))
From: https://bytes.com/topic/net/insights/750848-removing-all-spaces-inside-string-value-vb-net
本文介绍了一个使用VB.NET实现的公共函数,该函数能够有效地移除字符串中的所有空格。通过Regex.Replace方法结合正则表达式,此函数可以应用于任何需要清理文本数据的场景,提供了一种简洁的解决方案。
2万+

被折叠的 条评论
为什么被折叠?



