1. Kat: parse() Question

No, I haven't checked the docs yet... :)

If I have a string like this:

   "23 '17-5' 14 86"

can I parse on the spaces and have the single-quoted items come back
as one item?

So, for instance, this string

   "One Two 'Three Four' Five 'Six Seven Eight'"

would parse to

   { "One", "Two", "Three Four", "Five", "Six Seven Eight" }

I'm sure you've got a function for that... Can you help me out here?!

Thanks! :)
-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » topic index » view message » categorize

2. Re: Kat: parse() Question

cklester wrote:
> 
> No, I haven't checked the docs yet... :)
> 
> If I have a string like this:
> 
>    "23 '17-5' 14 86"
> 
> can I parse on the spaces and have the single-quoted items come back
> as one item?
> 
> So, for instance, this string
> 
>    "One Two 'Three Four' Five 'Six Seven Eight'"
> 
> would parse to
> 
>    { "One", "Two", "Three Four", "Five", "Six Seven Eight" }
> 
> I'm sure you've got a function for that... Can you help me out here?!

I've got exactly that function in my arsenal. I'll did it out and email it to
you.

-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view message » categorize

3. Re: Kat: parse() Question

Derek Parnell wrote:
> 
> cklester wrote:
> > 
> > So, for instance, this string
> > 
> >    "One Two 'Three Four' Five 'Six Seven Eight'"
> > 
> > would parse to
> > 
> >    { "One", "Two", "Three Four", "Five", "Six Seven Eight" }
> 
> I've got exactly that function in my arsenal. I'll did it out and email it to
> you.

Cool!! Thanks Derek...

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

4. Re: Kat: parse() Question

On 13 Oct 2004, at 14:47, cklester wrote:

> 
> 
> posted by: cklester <cklester at yahoo.com>
> 
> No, I haven't checked the docs yet... :)
> 
> If I have a string like this:
> 
>    "23 '17-5' 14 86"
> 
> can I parse on the spaces and have the single-quoted items come back
> as one item?

No.

> So, for instance, this string
> 
>    "One Two 'Three Four' Five 'Six Seven Eight'"
> 
> would parse to
> 
>    { "One", "Two", "Three Four", "Five", "Six Seven Eight" }
> 
> I'm sure you've got a function for that... Can you help me out here?!

No. But that looks simple enough that finding the include to handle it would 
take longer than re-writing it occasionally. For instance, you could replace all
the " " in the single-quotes with "_", and then parse would do what you want. 
In my experience, the way humans handle punctuation is riddled with errors. 
Parse(), or any function that calls it, can return the separators you specify, 
and i did that so i could recover from human error. In the return, the 
separators will be in their own lil sequence, where they were in relation to the
real tokens.

Kat

new topic     » goto parent     » topic index » view message » categorize

5. Re: Kat: parse() Question

On 13 Oct 2004, at 17:17, cklester wrote:

> 
> 
> posted by: cklester <cklester at yahoo.com>
> 
> Derek Parnell wrote:
> > 
> > cklester wrote:
> > > 
> > > So, for instance, this string
> > > 
> > >    "One Two 'Three Four' Five 'Six Seven Eight'"
> > > 
> > > would parse to
> > > 
> > >    { "One", "Two", "Three Four", "Five", "Six Seven Eight" }
> > 
> > I've got exactly that function in my arsenal. I'll did it out and email it
> > to
> > you.
> 
> Cool!! Thanks Derek...

See, you don't need me, ck. Sure beats making a request that the lib do 
something you want, doesn't it? This way, i don't ever need to make any 
improvements to strtok!

Kat

new topic     » goto parent     » topic index » view message » categorize

6. Re: Kat: parse() Question

Kat wrote:
> On 13 Oct 2004, at 14:47, cklester wrote:
> > posted by: cklester <cklester at yahoo.com>
> > 
> > So, for instance, this string
> > 
> >    "One Two 'Three Four' Five 'Six Seven Eight'"
> > 
> > would parse to
> > 
> >    { "One", "Two", "Three Four", "Five", "Six Seven Eight" }
> > 
> > I'm sure you've got a function for that... Can you help me out here?!
> 
> No. But that looks simple enough that finding the include to handle it would 
> take longer than re-writing it occasionally. For instance, you could replace
> all
> the " " in the single-quotes with "_"...

Actually, that's a good idea! Thanks, Kat.

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu