|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am wondering how to search a "word" within a TXT file
for example: I have a taxt file and i want to search if this txt file has the sentance/word "thank you for helping me" in the TXT file. can you guys help me out |
|
#2
|
||||
|
||||
|
open the text file for input. Read the text file into a string value one line at a time, and then look for your string using the instr() function... example
Code:
dim strTemp as string
dim Found as boolean
Found = False
Open "C:\YourTextFile.text" for input as #1
Do Until EOF(1)
Line Input #1, strTemp
if instr(strTemp,"Your string to find") > 0 then
Found = True
Exit Do
End if
Loop
Close #1
__________________
Fisherman "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein |
|
#3
|
|||
|
|||
|
thanks
it works perfect!!!
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > search for a "word" within a txt file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|