Re: Strtok-v2-1.e problem
On 31 Mar 2005, at 9:08, cklester wrote:
>
>
> posted by: cklester <cklester at yahoo.com>
>
> Haflidi Asgrimsson wrote:
> >
> > I'm parsing stings such as "1__2_3_4_5". I'm using Strtok-v2-1.e and what I
> > want is a sequence like {"1","","2","4","5"}. The parse function of
> > Strtok-v2-1.e gives me {"1","2","4","5"}. It splits the parse string into
> > atoms so "__" gives the same as '_'. There doesn't seem to be any substring
> > function in the standard library so I'm kind of stranded on this simple
> > issue.
> > Does anyone have a idea how to do this without writing a lot of code.
>
> Look at Michael Raley's "Parse with Keep" library...
>
>
> http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&key
> words=parse+with+keep
That would give him
{"1","","","2","","4","","5"}
You can't very well ask to toss the first delimiter and keep the remaining
delimiter in
your example. But anyhow, from the html doc for strtok:
New in v2.1 is "k" for keeping the separators in the parsed nested sequence, and
"i" for case insensitivity in comparing alphabetic strings (see the last 2
examples).
You can use "k" and "i" at the same time.
parse("nick!ident at a.net",{"k","!@"}) = {"nick","!","ident","@","a.net"}
Kat
Kat
|
Not Categorized, Please Help
|
|