std.stringbuffer
Janice Caron
caron800 at googlemail.com
Thu May 1 11:49:31 PDT 2008
On 01/05/2008, Spacen Jasset <spacenjasset at yahoo.co.uk> wrote:
> I think uppercasing non ascii (english) characters is a more of specialised
> business anyway (some languages have no notion of upper case, and yet others
> depend on context), which often should be perfomed by a presentation layer.
The Unicode Standard defines casing unambiguously for all characters.
Yes, toupper() of a Chinese character will leave it unchanged, but
it's still defined, and that is /not/ locale dependent.
However, casing in place is possible for UTF-8 if you're prepared to
throw an exception for those (extremely rare) cases when the sequence
length changes. So that means, you'd need two versions, the in-place
version
toUpperInPlace(char[] s) // might throw
and the general version
char[] toUpper(const(char)[] s, char[] buffer=null)
That could be done
More information about the Digitalmars-d
mailing list