VB拼接字符串去除空格

一 拼接"&" “+”

textData(0) = textData(1) & textData(0)

str=“8889”&“dhhh”

textData(0) = textData(1) +textData(0)

str=“8889”+“dhhh”

二 去除空格

    Dim k As Integer   

    Dim num As Integer 

    str = str1& str2拼接的字符串存在空格

     num = Len(str)   字符串的长度

     k = InStr(str, " ")  从第一位开始搜索空格

     For k = 0 To num  循环去除空格

     textData(0) = Replace(str, " ", "")

    Next k

猜你喜欢

转载自blog.csdn.net/qq_37591637/article/details/82804192
今日推荐