On Mon, 28 Jun 2004, Juerd wrote:

> Dave Whipp skribis 2004-06-28  9:55 (-0700):
> > > substr($string, 2 bytes, 4 bytes) = $substitute;
> > substr($string, 2, 4 :bytes)
>
> substr($string, 2 but graphemes, 4 but bytes);
>
> I think "but" even makes sense, if substr defaults to something.

I think mixing strings, bytes, graphemes, and code points together is a
phenomenally bad idea, likely to lead to many tears, much gnashing of
teeth, and quite a few rampages with sharp objects, not to mention a lot
of code guaranteed to fail at the edge cases.

If, as a programmer, you *really* want to run with scissors then convert
your string to a binary byte buffer and go from there. At least then when
you poke out an eye you won't be nearly so surprised.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to