What's the intended use case for string increment / decrement?

It just seems like madness to me, using mathematical operators with
strings, producing seemingly arbitrary results in some circumstances (C ->
B -> A -> NULL / False ?).

Also what happens in other languages? Take for example German, in which ß
comes after S, Ü after U, and so on.


On Fri, Jul 19, 2013 at 9:59 AM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote:

> Hi,
>
> I take a look at the code.
> It does support [0-9] also.
>
> [yohgaki@dev tests]$ php -r "\$a = ' a10';for (\$i=0; \$i<10;\$i++)
> var_dump(++\$a);"
> string(4) " a11"
> string(4) " a12"
> string(4) " a13"
> string(4) " a14"
> string(4) " a15"
> string(4) " a16"
> string(4) " a17"
> string(4) " a18"
> string(4) " a19"
> string(4) " a20"
>
> It sounds good to have string decrements.
>
>
> 2013/7/19 Peter Lind <peter.e.l...@gmail.com>
>
> > Interesting to note that although Perl 6 is apparently capable of
> > decrementing strings, it doesn't fully mirror the incrementing:
> >
> > http://feather.perl6.nl/syn/S03.html#line_516
> >
> > Specifically: decrementing 'AAA' would not turn into 'ZZ' but would
> error,
> > according to that link
> >
>
> Carry handle of decrements is more complex than increments.
> It may be the reason.
>
> Regards,
>
> --
> Yasuo Ohgaki
> yohg...@ohgaki.net
>



-- 

*Dan Cryer*

 07590 698944
 d...@dancryer.com
 +Dan <https://plus.google.com/101400775372325517263>
 @dancryer <http://www.twitter.com/dancryer>

Reply via email to