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.
Note
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.
Example
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
assert(decompose('Ĉ')[] .equal("C\u0302"));
assert(decompose('D')[] .equal("D"));
assert(decompose('\uD4DC')[] .equal("\u1111\u1171\u11B7"));
assert(decompose!Compatibility('¹')[] .equal("1"));
Authors
Dmitry Olshansky
License
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.