Converting a character to upper case in string

Laurent Tréguier laurent.treguier.sink at gmail.com
Fri Sep 21 12:34:12 UTC 2018


On Friday, 21 September 2018 at 12:15:52 UTC, NX wrote:
> How can I properly convert a character, say, first one to upper 
> case in a unicode correct manner?
> In which code level I should be working on? Grapheme? Or maybe 
> code point is sufficient?
>
> There are few phobos functions like asCapitalized() none of 
> which are what I want.

I would probably go for std.utf.decode [1] to get the character 
and its length in code units, capitalize it, and concatenate the 
result with the rest of the string.

[1] https://dlang.org/phobos/std_utf.html#.decode


More information about the Digitalmars-d-learn mailing list