Thank you for the tip. It willl surely help me.
I think I have found a module that does what I want, but I don't know if I
will use it.

Teddy,
My dear email address is [EMAIL PROTECTED]

----- Original Message -----
From: "Wiggins d'Anconia" <[EMAIL PROTECTED]>
To: "Octavian Rasnita" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, September 06, 2002 5:13 AM
Subject: Re: Splitting a string


I am sure one of the gurus probably has a cool regex to do this, but I
haven't gotten to that book yet ;-)........

One solution and by no means the fastest or shortest, would be to split
on space, then step through your returned list checking the beginning of
each element, if that element starts with a " then set a flag, then
continue stepping through the array looking at each element and
concatenating it together until you find an element that ends with ",
then unset your flag and push the concatenated string to a separate
array and keep going.  For elements that do not begin with a " while
your flag is unset you know they are single elements and can be pushed
directly to the array, same goes for elements that both start and end
with the ".

You didn't seem to want the code, so I leave that to you, from a
procedural standpoint that is how it *could* be done.

http://danconia.org

Octavian Rasnita wrote:
> Hi all,
>
> I want to split a string but it is a little too complicated for me.
> If it is too complicated, don't give me an answer but just a little hint
to
> the right direction.
>
> I have a string like the following example (used to search in a search
> engine):
>
> "perl editor" free "blind accessible"
>
> I would like to split this string in such a way, so I would have 3
strings:
>
> perl editor
> free
> blind accessible
>
> In the string I could have no sub strings included in "" or more than 2
like
> in my example.
>
> Thank you very much for the hint.
>
> Teddy,
> My dear email address is [EMAIL PROTECTED]
>
>
>




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to