RE: strtok question
- Posted by Brian Broker <bkb at cnw.com> Mar 12, 2003
- 380 views
But then I'm essentially making two passes to get what I want (first pass to replace, second to parse). I was wondering if there was a way to get what I want with just one pass... -- Brian Kat wrote: > On 12 Mar 2003, at 19:31, Brian Broker wrote: > > > > > For Kat or any others familiar with the lib: > > > > Question: Is there an easy way to keep some separators while removing > > others? For example, if I was parsing a BASIC-like language and I > > wanted to keep comparison and math operators while stripping white > > space? > > > > example: > > if x=y then --> {"if","x","=","y","then"} > > > > I was hoping to do a single pass because I figured I could always first > > replace "=" with " = " then parse on white space... > > I don't understand the question. If you replace "=" with " = ", parse() > will > return as you give in your example. > > Kat > >