Re: Feature Proposal: Allow letter decrementing
| From: | Yasuo Ohgaki | Date: | Fri, 19 Jul 2013 08:59:34 +0000 |
| Subject: | Re: Feature Proposal: Allow letter decrementing | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-68187@lists.php.net to get a copy of this message | ||
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.lind@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
yohgaki@ohgaki.net