View source code
Display the source code in std/uni.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
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.

Function std.uni.compose

Try to canonically compose 2 characters. Returns the composed character if they do compose and dchar.init otherwise.

dchar compose (
  dchar first,
  dchar second
) pure nothrow @safe;

The assumption is that first comes before second in the original text, usually meaning that the first is a starter.

Note

Hangul syllables are not covered by this function. See composeJamo below.

Example

writeln(compose('A', '\u0308')); // '\u00C4'
writeln(compose('A', 'B')); // dchar.init
writeln(compose('C', '\u0301')); // '\u0106'
// note that the starter is the first one
// thus the following doesn't compose
writeln(compose('\u0308', 'A')); // dchar.init

Authors

Dmitry Olshansky

License

Boost License 1.0.