Vb.net 删除字符串中的所有空格
vb.net中是否有删除字符串中所有空格的函数。 我的意思是像“这是什么”这样的字符串应该是“Whatisthis” 谢谢Vb.net 删除字符串中的所有空格,vb.net,Vb.net,vb.net中是否有删除字符串中所有空格的函数。 我的意思是像“这是什么”这样的字符串应该是“Whatisthis” 谢谢 Furqan您可以使用字符串。替换: Dim str As String = " What is this" str = str.Replace(" ", "") 使用 使用字符串。替换: Dim Test As String = "Hello Hi" Test = Test.Replace(" ", String.Empty) 我已经成功地使用了str=str.Rep
Furqan您可以使用字符串。替换:
Dim str As String = " What is this"
str = str.Replace(" ", "")
使用
使用
字符串。替换:
Dim Test As String = "Hello Hi"
Test = Test.Replace(" ", String.Empty)
我已经成功地使用了str=str.Replace(“,”)
但是,str=str.Replace(“,”)
在过去对我不起作用。str.Replace
无法修改原始字符串,因此您的代码不会有任何效果。请改用str=str.Replace(“,”)
。谢谢,有类似于Trim的功能吗?是的,名称恰当,但它只删除字符串开头和结尾的空格。
Dim Test As String = "Hello Hi"
Test = Test.Replace(" ", String.Empty)