第1个回答 推荐于2017-05-25
'重新发一次:
'这样,可去除空格
Private Sub Command1_Click()
dim a as string,b as string
a="1234 5678"
for i=1 to len(a)
if mid(a,i,1)<>" " then
b=b & mid(a,i,1)
end if
next i
print "去除空格前: " & a
print "去除空格后: " & b
end sub本回答被网友采纳
第2个回答 2013-07-17
类似 dim a as string a=“ a b” 然后你可以调用a.trim()就是去掉空格。
第3个回答 2019-11-12
要那么麻烦干嘛,占用篇幅,还费头脑去看和理念。
用最简单的就好了
Replace(字符串, " ", "")
例:
text1.text=Replace(text1.text, " ", "")
第4个回答 2018-04-27
Replace(expression, find, replace[, start[, count[, compare]]])
举例:替换掉字符串中空格
Dim a As String
a = "+ ab c +"
MsgBox Replace(a, " ", "")