The OpenD Programming Language

toUpper

If c is a Unicode lowercase $(CHARACTER), then its uppercase equivalent is returned. Otherwise c is returned.

Warning: Certain alphabets like German and Greek have no 1:1 upper-lower mapping. Use overload of toUpper which takes full string instead.

toUpper can be used as an argument to std.algorithm.iteration.map to produce an algorithm that can convert a range of characters to upper case without allocating memory. A string can then be produced by using std.algorithm.mutation.copy to send it to an std.array.appender.

  1. dchar toUpper(dchar c)
    version(!std_uni_bootstrap)
    @safe pure nothrow @nogc
    dchar
    toUpper
    (
    dchar c
    )
  2. ElementEncodingType!S[] toUpper(S s)
  3. ElementEncodingType!S[] toUpper(S s)

Examples

import std.algorithm.iteration : map;
import std.algorithm.mutation : copy;
import std.array : appender;

auto abuf = appender!(char[])();
"hello".map!toUpper.copy(abuf);
assert(abuf.data == "HELLO");

Meta