Skip to content

Unicode library for getting East Asian Width property.

License

Notifications You must be signed in to change notification settings

gdamore/east_asian_width

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

east_asian_width

Unicode library for getting East Asian Width property

import eastasianwidth;

assert(displayWidth("あいうえお") == 10);

// '☆' is Ambiguous character
assert(displayWidth('') == 1);
assert(displayWidth('', AmbiguousCharWidth.wide) == 2);
assert(displayWidth("☆D言語くん☆") == 11);
assert(displayWidth("☆D言語くん☆", AmbiguousCharWidth.wide) == 13);

assert(eastAsianWidth('') == EastAsianWidthProperty.F); // Fullwidth
assert(eastAsianWidth('') == EastAsianWidthProperty.H);  // Halfwidth
assert(eastAsianWidth('') == EastAsianWidthProperty.W); // Wide
assert(eastAsianWidth('A') == EastAsianWidthProperty.Na); // Narrow
assert(eastAsianWidth('') == EastAsianWidthProperty.A); // Ambiguous
assert(eastAsianWidth('À') == EastAsianWidthProperty.N);  // Neutral

About

Unicode library for getting East Asian Width property.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • D 100.0%