Hi,
I currently have a string, ie <TEXT default_lang="en" str="Button text"/> and I want to be able to remove <TEXT default_lang="en" str=" and "/> so I am left with Button Text
If you could help me in any way I would be greatful
thank you
Luke

Here is one way to do it. It assumes that the structure of the string remains the same all the time.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim StartPoint As Integer = TextBox1.Text.IndexOf("str=")
        If StartPoint >= 0 Then
            StartPoint += 5
            Dim EndPoint = TextBox1.Text.IndexOf("/>", StartPoint)
            If EndPoint > StartPoint Then
                TextBox2.Text = TextBox1.Text.Substring(StartPoint, EndPoint - 1 - StartPoint)
            End If
        End If
    End Sub

Another way. If your text is in a textbox then click between the "" marks and then press a button. as:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim StartPoint As Integer = TextBox1.Text.LastIndexOf(Chr(34), TextBox1.SelectionStart) + 1
        Dim EndPoint As Integer = TextBox1.Text.IndexOf(Chr(34), TextBox1.SelectionStart)
        TextBox2.Text = TextBox1.Text.Substring(StartPoint, EndPoint - StartPoint)
    End Sub

hay how are u by using split we can split the string

Member Avatar for iamthwee

That looks like an 'attribute' within an xml file.

Therefore it would be sensible to use consider it as an xml object and use the methods associated with that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.