vb怎么去除字符串中间的空格

avatar
作者
筋斗云
阅读量:0

在VB中,可以使用Replace函数来去除字符串中间的空格。下面是一个示例代码:

Dim str As String Dim newStr As String  str = "Hello World" newStr = Replace(str, " ", "")  MsgBox newStr 

在这个示例中,将会创建一个名为str的字符串变量,并将其设为"Hello World"。然后通过Replace函数,将空格替换为空字符串,最终将结果存储在newStr中。最后使用MsgBox显示最终结果。

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!