VBGamer |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
RE: String Splitting Adam Hoult (3 replies, 0 views) (2000-May-9) Hey david =)
Yeah your right about that, php rules !! =)
Well as far as i can see it, from what you explained, and without seeing the whole picture, then basically it;s a case of.
Line Input #1,Tempstring
MyVar = Left$(TempString,Instr(TempString,"(")-1)
Of course an instr isn't very efficient in speed critical loops but VB's string manipulation routines are pretty poor when it comes to speed it has to be said. (If you don't believe me, get hold of a copy of a decent debugger, and see how many asm instructions you have to step through just for an instr =)
Anyway, that pretty much only covers the thing you mentioned, "and need
to be able to read from it say, until a '(' is encountered". VB6 has the new Split function (like Explode() in PHP) but it's not really that useful in this case (apart from splitting parameters inside brackets for example seperated by commas.)
Oh i wish MS would sort out some decent regex functions =), long live eregi !!! hehe. (php users will know what im going on about there).
If you can be a bit more specific about EXACTLY what you need to do, i.e the whole thing like you want also to take the stuff out of the brackets too, and blah.
If your interested, i started work a while back on dDX basic, which is basically an ide, which takes what you type in the code window and splits up all the words parameters functions brackets etc, it even does the auto fill, i.e when you press the fullstop/period key it brings up the list. Very much like VB. Then it brings up errors if there were no parameters or an incorrect number, or if there should have been an = in between etc etc. So i could knock together a sample of parsing a script no problem, (as dDX basic does this all in realtime as you type).
Let me know
Adam
|