how to get specific string from unpredicted input messages?
Hi sir, I'm newbie here. I just want your help.
Let's say, I have these code in my vb:
Code:
dim msg1, msg2 as string
msg1=textbox1.text
'notes that textbox1 will be inputed with random string but will contain myname: blablabla
'example
textbox1.text="newejjdhajdahksjmyname: blablabla asljdsjdksk"
'or may be inputed like this:
textbox1.text="asfdssadadamyname: blablabla asadsdasghfhgfhfghfgfhgfgfga"
msg2 = msg1.find(......i don't know how to coding it)
textbox2.text="your name: " + msg2
sorry if I type incorrect english. thanks.
Re: how to get specific string from unpredicted input messages?
Take a look at this
Code:
Dim smplText As String = "asfdssadadamyname: blablabla asadsdasghfhgfhfghfgfhgfgfga"
Dim strToFind As String = "blablabla"
Dim idx As Integer = smplText.IndexOf(strToFind)
If idx >= 0 Then
'string found
Else
'not found
End If
Re: how to get specific string from unpredicted input messages?
Quote:
Originally Posted by
dbasnett
Take a look at this
Code:
Dim smplText As String = "asfdssadadamyname: blablabla asadsdasghfhgfhfghfgfhgfgfga"
Dim strToFind As String = "blablabla"
Dim idx As Integer = smplText.IndexOf(strToFind)
If idx >= 0 Then
'string found
Else
'not found
End If
Great suggestion. Thanks a lot sir.