Hi all,
I have a textbox with values as ";1;2;3;" and may be "1"
I want to remove either 1 or 2 or 3 with the ; symbol.Please note that the value may be without ; , if it is single value
Thanks in Advance
Dana
Printable View
Hi all,
I have a textbox with values as ";1;2;3;" and may be "1"
I want to remove either 1 or 2 or 3 with the ; symbol.Please note that the value may be without ; , if it is single value
Thanks in Advance
Dana
I'm using two textboxes for demonstration only so change it as necessary:
Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox2.Text = StripCharacter(TextBox1.Text, "1;")
End Sub
Private Function StripCharacter(ByVal source As String, ByVal mychar As String) As String
Dim result As String
If source.IndexOf(mychar) >= 0 Then
result = source.Substring(source.IndexOf(mychar) + mychar.Length)
Else
result = source
End If
Return result
End Function
Dear Rhino,
Thanks for ur reply.It may not contain ; symbol ?
Dan
You have to try it to see how it works.