VB6乘坐大空间

Ste*_*hRT 1 vb6

嘿所有,我试图用一个文本替换文本之间的大空间.我的输出现在看起来像这样:

5964215">

        This is just the first example of the spaces
    5964478">

        This would be the 2nd example of showing how many spaces this thing has in each sentence.
    5964494">
Run Code Online (Sandbox Code Playgroud)

这来自一个多线到真的文本框.这是它没有多行真实时的样子.

http://www.june3rdsoftware.com/forums/vb6.jpg

我似乎无法让空间消失!顺便说一句,如果这有任何区别,这个文本来自网页.

大卫

Doc*_*own 6

根据MvanGeest的建议,这里有一些VB代码来替换空白块:

Sub test()
    Dim x As String, y As String
    x = "abcd       defg             1233"
    Dim re As New RegExp
    re.Pattern = "\s+"
    re.Global = True
    y = re.Replace(x, " ")
    Debug.Print y
End Sub
Run Code Online (Sandbox Code Playgroud)

要使其工作,您必须在项目中添加对"Microsoft VBScript Regular Expresssions"的引用.