Hi,

2013/7/19 Peter Lind <peter.e.l...@gmail.com>

> On 19 July 2013 11:18, Dan Cryer <d...@dancryer.com> 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.
>

++/-- 'XYZ00001234' would have use cases.


>
>
>> It just seems like madness to me, using mathematical operators with
>> strings, producing seemingly arbitrary results in some circumstances (C ->
>> B -> A -> NULL / False ?).
>>
>>
> Throw a warning and don't decrement A/a any further - that's not arbitrary.
>

-- is more problematic.
--'XYZ0000' would be 'XYZ0000' or 'XYY00000' or 'XYY'?

It would be better not to change length of string, IMO.
e.g. --'XYZ0000' became 'XYY0000'

All chars would stop decrement at lowest chars of [0-9], [a-z], [A-Z].
e.g. Lowest value of 'XYZ0000' is 'AAA0000'.

This is not a symmetric operation of ++, but it's impossible to achieve
symmetric
operation ++/-- on strings anyway.


>
>> Also what happens in other languages? Take for example German, in which ß
>> comes after S, Ü after U, and so on.
>>
>>
> Nothing, works purely on ascii, as is currently the case. Perl handles
> other character sets though - see the link I posted for details on how.
>

There may be need for this, but it will be very complex code than now.
[0-9a-zA-Z] would be enough. PHP doesn't have default multibyte char
module, too.

Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net

Reply via email to