Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search string for specific letter

Status
Not open for further replies.

EddyLLC

Technical User
Mar 15, 2005
304
US
Using the following code I am opening a text file and taking each line and putting it into the variable str1 one line at a time. I am also opening another file to write the resulting modified text back into. What I want to do is find the first instance of a letter sequence (ie M then a space)and put a carriage return in then write the resulting abbreviated line into the Results file.

How do I search a string to find the first instance of the letter sequenc?
Thnaks

Open ABIFileLoc For Input As #1
Open Results For Output As #2 ' Opens the File to hold the trimmed results.
Do Until EOF(1)
Line Input #1, str1
' Find letter sequence and add carriage return
Print #2
 


Hi,

Check out the InStr function

Skip,

[glasses] [red]Be Advised![/red] Dyslexic poets...
write inverse! [tongue]
 


..and the Replace function.

Skip,

[glasses] [red]Be Advised![/red] Dyslexic poets...
write inverse! [tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top