Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 删除字符串中的所有空格_Vb.net - Fatal编程技术网

Vb.net 删除字符串中的所有空格

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

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.Replace(“,”)


但是,
str=str.Replace(“,”)
在过去对我不起作用。

str.Replace
无法修改原始字符串,因此您的代码不会有任何效果。请改用
str=str.Replace(“,”)
。谢谢,有类似于Trim的功能吗?是的,名称恰当,但它只删除字符串开头和结尾的空格。
Dim Test As String = "Hello Hi"
Test = Test.Replace(" ", String.Empty)