BBS: Inland Empire Archive Date: 05-24-92 (13:13) Number: 166 From: RICHARD VANNOY Refer#: NONE To: JEFF BEER Recvd: NO Subj: Strings Conf: (2) Quik_Bas
JB>How do I test each character in a variable length string to find the JB>start and stop positions of the words I want to pull out? JB>It should be easy, but I can't remember... the words I want are in JB>all caps, and the rest are small case. I also want to pull variable JB>sized numbers (no more than three digits) and I assume the procedure JB>would be the same. BTW - this is from an ascii sequential log file. DO LINE INPUT #1, lin$ FOR i = 1 TO LEN(lin$) a = ASC(MID$(lin$,I,1)) SELECT CASE a CASE 48-57 'It is a number 0-9 number = VAL(MID$(lin$,i)) PRINT number 'Now skip to next NON-number FOR j = i + 1 TO LEN(lin$) a = ASC(MID$(lin$,J,1)) IF A < 48 OR a > 57 THEN i = j 'Reset I to new value EXIT FOR END IF NEXT j CASE 65-90 'It is an upper case letter PRINT CHR$(a); 'Do the same as above to "walk" to the end of 'the word. END SELECT NEXT i WHILE NOT EOF(1) > MegaMail 2.1b #0:At least I can use his code as a bad example! --- WM v2.01/91-0012 * Origin: Com-Dat BBS Hillsboro, OR. HST (503) 681-0543 (1:105/314)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET