Resolved weird problem with replacing space in text from a web-page

jamesvick

Active member
Joined
Jul 19, 2010
Messages
34
Programming Experience
1-3
Hello i have two lines of text which have long space (more like 14-15 spaces) before the actual text. I have tried simple replace to split and merge but nothing is working. I have also tried trim and the worst thing is that ascii gives code of 32. But nothing works. here is the text :

VB.NET:
                                                              your heartburn symptoms
                        Certain foods, such as fat, chocolate, caffeine and alcohol can aggravate heartburn symptoms 1
                        Certain foods

(BTW it's not like it looks it is. In my actual richtextbox, when i select the space it gets selected as one big piece of space like a tab and i have also tried replacing vbtab but no use)

What i want is :

VB.NET:
your heartburn symptoms
Certain foods, such as fat, chocolate, caffeine and alcohol can aggravate heartburn symptoms 1
Certain foods

Believe me i have tried almost 7-8 diffferent function but now iam going mad. one of my logic :

VB.NET:
Dim lineArray As String() = rtfArticle.Lines

            For z As Integer = 0 To lineArray.Length - 1
                Dim w As String() = lineArray(z).Split(" ")
                MsgBox(lineArray(z))
                Dim tmp As String = ""

                For Each s34 As String In w
                    If (s34 <> " ") Then
                        temp = temp & " " & s34
                    End If
                Next
                lineArray(z) = temp
            Next

it completely messes up the code. Any idea about this?


EDIT SOLUTION :

VB.NET:
Dim lineArray As String() = rtfArticle.Lines
For z As Integer = 0 To lineArray.Length - 1
    w(z) = lineArray(z).Trim()
 
Last edited:
Back
Top