Re: explode and escape character for string separator
| From: | Reuben D. Budiardja | Date: | Fri, 18 Jul 2003 19:18:23 +0000 |
| Subject: | Re: explode and escape character for string separator | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-155824@lists.php.net to get a copy of this message | ||
On Friday 18 July 2003 03:01 pm, you wrote:
> > On Friday 18 July 2003 02:42 pm, Chris Shiflett wrote:
> > > --- "Reuben D. Budiardja" <reubendb@innovativethought.com> wrote:
> > > > Suppose I have a long string like
> > > > $myStr = "$string1:$string2:$string3";
> > > >
> > > > I can obviously explode them using ":" as the separator. But what if
> > > > $string1 contains the character ":" by itself?
> > >
> > > You should strive to make your delimiter unique. A delimiter that might
> > > possibly appear within the items it is meant to delimit is no longer a
> > > delimiter.
> >
> > I did strive for that. But whatever character I choose, the problem
>
> remains
>
> > that we can't guarantee that it's going ot be only used as deliminater,
>
> since
>
> > the deliminated string is an input from user. So the problem remains.
>
> So choose another method.
I would if I can think of better method.
That answer does not help.
RDB