|
-
February 6th, 2000, 08:52 AM
#1
Urgent!! How can I get a string from a specific position in a HTML file e.g line 50, 13-20 character
Urgent!! How can I get a string from a specific position in a HTML file e.g line 50, 13-20 characters
-
February 7th, 2000, 12:36 AM
#2
Re: Urgent!! How can I get a string from a specific position in a HTML file e.g line 50, 13-20 chara
dim myFile as string
dim myLine as integer
dim myString as string
dim myStringStart as integer
dim myStringEnd as integer
dim myLineCounter as integer
dim strData as string
dim ok as boolean
myFile = "c:\myhtml.html" 'file to examine
myLine = 50 'line to examine
myStringStart = 13 'starting position of string to get
myStringEnd = 20 'ending position of string to get
myLineCounter = 0 'counting lines
ok = false
open myFile for input as #1
do while (not(eof(1)) and not(ok))
myLineCounter = myLineCounter + 1
Line input #1, strData
if myLineCounter = myLine then 'if the read line is the one we need
myString = mid(myLine,myStringStart,myStringEnd - myStringStart)
ok = true
end if
loop
if ok then 'if we reached the line
msgbox "Retrieved " & myString
else 'in case the file did not contain myLine lines
msgbox "Retrieving string failed"
end if
Tom Cannaerts
[email protected]
The best way to escape a problem, is to solve it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|