PDA

Click to See Complete Forum and Search --> : finding strings


DiGiTaIErRoR
Dec 1st, 1999, 09:12 PM
i need to be able to find all instances of
' } CHATSTR " '
then get the text inbetween " " here's how the text looks
} CHATSTR "command" == IF
I would need to find command and add it to a menu. The menu name is Scripts. Remember I need to find all commands in the entire file. Thanks and please include source code.


------------------
DiGiTaIErRoR

john_murphy
Dec 1st, 1999, 10:04 PM
Here you go
This will do what you want

Open "c:\john.txt" For Input As 1
Dim mydata As String
Dim search_string As String
search_string = "}CHATSTR "
Do While Not EOF(1)
Line Input #1, mydata
look = InStr(1, mydata, search_string, 1)
If look <> 0 Then
mydata = Mid(mydata, look + 10)
mydata = Mid(mydata, 1, (InStr(1, mydata, Chr(34), 1) - 1))
MsgBox (mydata)
End If
Loop
Close #1

DiGiTaIErRoR
Dec 2nd, 1999, 04:29 AM
that would work great if it opned the file but the text is aready in a text box.

------------------
DiGiTaIErRoR