std.uni.toUpper
- multiple declarations
Function toUpper
If c
is a Unicode lowercase character, then its uppercase equivalent
is returned. Otherwise c
is returned.
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 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 copy
to send it to an appender
.
Example
import std .algorithm .iteration : map;
import std .algorithm .mutation : copy;
import std .array : appender;
auto abuf = appender!(char[])();
"hello" .map!toUpper .copy(abuf);
writeln(abuf .data); // "HELLO"
Function toUpper
Allocates a new array 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 if s
is a string
-like type.
ElementEncodingType!S[] toUpper(S)
(
S s
)
if (isSomeString!S || isRandomAccessRange!S && hasLength!S && hasSlicing!S && isSomeChar!(ElementType!S));
Parameters
Name | Description |
---|---|
s | A random access range of characters |
Returns
An new array with the same element type as s
.
Authors
Dmitry Olshansky