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.decompose

Returns a full Canonical (by default) or Compatibility decomposition of character ch. If no decomposition is available returns a Grapheme with the ch itself.

Grapheme decompose(UnicodeDecomposition decompType = Canonical) (
  dchar ch
) @safe;


This function also decomposes hangul syllables as prescribed by the standard.

See Also

decomposeHangul for a restricted version that takes into account only hangul syllables but no other decompositions.


import std.algorithm.comparison : equal;

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



Dmitry Olshansky


Boost License 1.0.