逐个字符判断,去掉空格、回车、NULL。

解决方案 »

  1.   

    Do While i < Len(str)
           If Mid(str, i + 1, 1) = " " Then
             i = i + 1
             If  And Mid(str, j + 1, 1) <> " " Then
               'MsgBox Mid(str, j + 1, i - j - 1)
               result = result & Mid(str, j + 1, i - j - 1)
             End If
             j = i
           Else
             i = i + 1
           End If
         Loop
    result = result+Mid(str, j + 1, i + 1 - (j + 1))
      

  2.   

    谢谢
    不是很明白,如果第一块文本在text1里我想把处理过的写到text2里应该怎么写代码?
    我是新手,不好意思
      

  3.   

    还有, ayuu大哥,你的代码里的If  And Mid(str, j + 1, 1) <> " " Then的and是不是不多余了?