lower case only first letter of word

Jacob Carlborg doob at me.com
Tue Dec 5 15:49:48 UTC 2017


On 2017-12-05 15:34, Mengu wrote:

> this is how i'd do it:
> 
> string upcaseFirst(string wut) {
>    import std.ascii : toUpper;
>    import std.array : appender;
> 
>    auto s = appender!string;
>    s ~= wut[0].toUpper;
>    s ~= wut[1..$];
>    return s.data;
> }

That's not Unicode aware and is only safe to do with single byte characters.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list