View source code Display the source code in std/uni.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

std.uni.to_upper - multiple declarations

Function toUpper

If c is a Unicode lowercase , then its uppercase equivalent is returned. Otherwise c is returned.

Prototype

dchar toUpper(
  dchar c
) pure nothrow @nogc @safe;

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.

Example

import std.algorithm;
import std.uni;
import std.array;

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

Function toUpper

Returns a string which is identical to s except that all of its characters are converted to uppercase (by preforming Unicode uppercase mapping). If none of s characters were affected, then s itself is returned.

Prototype

S toUpper(S)(
  S s
) pure @trusted
if (isSomeString!S);

Authors

Dmitry Olshansky

License

Boost License 1.0.

Comments