Hi Nikita,
2013/7/19 Nikita Popov
> I don't think we should add string decrementing due to the rather complex
> logic behind it (imho the string incrementing that we have shouldn't be
> there either).
>
Right. It is impossible to symmetric operation ++/-- for strings.
Not implementing --'STRING
What's the intended use case for string increment / decrement?
>>> Personally, I instantly think of mirroring spreadsheet columns - works
>>> quite well in that context.
>>>
>>
>> ++/-- 'XYZ1234' would have use cases.
I once had an app which needed to generate long continuous ra
On 19 July 2013 12:34, Yasuo Ohgaki wrote:
> Hi,
>
> 2013/7/19 Peter Lind
>
>> On 19 July 2013 11:18, Dan Cryer wrote:
>>
>>> What's the intended use case for string increment / decrement?
>>>
>>>
>> Personally, I instantly think of mirroring spreadsheet columns - works
>> quite well in that co
On Thu, Jul 18, 2013 at 3:46 PM, Chris London wrote:
> My friend shared some code with me today that wasn't working for him. He
> was incrementing letters like this:
>
> $letter = 'A';
> echo ++$letter; // Output: B
>
> He was then trying to decrement letters like this:
>
> $letter = 'B';
> echo
Hi,
2013/7/19 Peter Lind
> On 19 July 2013 11:18, Dan Cryer wrote:
>
>> What's the intended use case for string increment / decrement?
>>
>>
> Personally, I instantly think of mirroring spreadsheet columns - works
> quite well in that context.
>
++/-- 'XYZ1234' would have use cases.
>
>
On 19 July 2013 11:18, Dan Cryer wrote:
> What's the intended use case for string increment / decrement?
>
>
Personally, I instantly think of mirroring spreadsheet columns - works
quite well in that context.
> It just seems like madness to me, using mathematical operators with
> strings, produc
On Fri, Jul 19, 2013 at 5:18 PM, Dan Cryer wrote:
> What's the intended use case for string increment / decrement?
>
+ 1
could we please stop wasting time on such issues? many thanks
> It just seems like madness to me, using mathematical operators with
> strings, producing seemingly arbitrary
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, i
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"
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
--
WWW: plphp.dk / p
Hi,
2013/7/19 Mateusz Kocielski
> > see http://www.php.net/manual/en/language.operators.increment.php
>
> I don't see any explanation for the examples above. Documentation says:
>
> [...] For example, in PHP and Perl $a = 'Z'; $a++; turns $a into 'AA' [...]
>
> I'd expect " ZZ" to become " AAA"
On Thu, Jul 18, 2013 at 4:37 PM, Xinchen Hui wrote:
>> Hello,
>>
>> Does anybody understand the rules behind the string incrementation? What's
>> the explanation of following behaviour?
>>
>> '$x="ZZ";$x++;var_dump($x);' returns string(3) "AAA"
>> '$x=" ZZ";$x++;var_dump($x);' returns string(3) "
On Thu, Jul 18, 2013 at 7:18 PM, Chris London wrote:
> I hear Perl 6 supports Str decrementing
>
>
I heard of Perl 6 once.
I hear Perl 6 supports Str decrementing
On Jul 18, 2013 5:11 PM, "Sara Golemon" wrote:
> > My question is, why specifically doesn't it?
> >
> > Because Perl.
>
> My question is, why specifically doesn't it?
>
> Because Perl.
The one caveat about decrementing "A" and it goes to NULL is that if you
increment NULL it goes to 1 so that may be confusing. We could also
decrement "A" and it goes to FALSE and FALSE++ is still FALSE
On Thu, Jul 18, 2013 at 1:10 PM, Phil Sturgeon wrote:
> Incrementing "Z" results in "AA", b
Something I learned today is incrementing 'Z' goes to 'AA' but that helps
the point that it could use more work/clarification
On Thu, Jul 18, 2013 at 1:08 PM, Martin Amps wrote:
> One hiccup. I imagine maybe the reason we don't support decrementing is
> because what would happen if you tried to
> One hiccup. I imagine maybe the reason we don't support decrementing is
> because what would happen if you tried to decrement 'A'. In that case I
> would suggest either returning NULL or throwing a notice.
It would make sense to make it stay as ‘A’ like incrementing ‘Z' stays as ‘Z’.
I do agree
在 2013-7-18,22:31,Mateusz Kocielski 写道:
It seems logical that if we support increment we should support decrement.
My proposal:
1) Support decrementing letters
- or -
2) Throw a notice explaining that decrementing is not supported so
developers quickly know they can't do that
One hiccup.
On Thu, 2013-07-18 at 07:46 -0600, Chris London wrote:
> My friend shared some code with me today that wasn't working for him. He
> was incrementing letters like this:
>
> $letter = 'A';
> echo ++$letter; // Output: B
>
> He was then trying to decrement letters like this:
>
> $letter = 'B';
> ec
> It seems logical that if we support increment we should support decrement.
>
> My proposal:
>
> 1) Support decrementing letters
> - or -
> 2) Throw a notice explaining that decrementing is not supported so
> developers quickly know they can't do that
>
> One hiccup. I imagine maybe the reason we
My friend shared some code with me today that wasn't working for him. He
was incrementing letters like this:
$letter = 'A';
echo ++$letter; // Output: B
He was then trying to decrement letters like this:
$letter = 'B';
echo --$letter; // Output: B
He was really confused why his code wasn't work
22 matches
Mail list logo