Fast Line Parser
Posted: Fri Jan 16, 2009 2:58 am
Anybody have a fast code for parsing a line of text? I have one but it takes about 5 seconds to process 65,000 lines of text. I don't exactly need to extract the word just return the pointer of the first character in the text.
Something like this...
a$ = "the quick brown fox jumps over the lazy dog"
DO
ParseLine a$, Position, Length
IF Length > 0 THEN
PRINT MID$(a$, Position, Length)
ELSE
EXIT DO
END IF
LOOP
The result I'm looking for are these for a total of 9 loops.
1 3 the <-- position=1, length=3, word=the
5 5 quick <-- position=5, length=5, word=quick
.
.
41 3 dog <-- position=41, length=3, word=dog
Is there another way of parsing the line without examining every single character in the string?
Something like this...
a$ = "the quick brown fox jumps over the lazy dog"
DO
ParseLine a$, Position, Length
IF Length > 0 THEN
PRINT MID$(a$, Position, Length)
ELSE
EXIT DO
END IF
LOOP
The result I'm looking for are these for a total of 9 loops.
1 3 the <-- position=1, length=3, word=the
5 5 quick <-- position=5, length=5, word=quick
.
.
41 3 dog <-- position=41, length=3, word=dog
Is there another way of parsing the line without examining every single character in the string?