Skip to content

mvitlov/east_asian_width

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A lightweight library for detecting East Asian Width of Unicode characters. Useful for text layout and alignment.

Features

  • Get East Asian Width from a character
  • Get length of a single character in terms of display width
  • Get length of a String in terms of the number of characters
  • Split a String considering surrogate-pairs
  • Slice a String with correct handling of East Asian Width characters

Usage

For more examples, see /example and /test folders.

import 'package:east_asian_width/east_asian_width.dart' as eaw;

// Using functions
print(eaw.eastAsianWidth('뀀').abbrev); // 'W'

// Using extension on Strings
print('뀀'.eastAsianWidth.abbrev); // 'W'

Additional information

Ported from Javascript. Original code can be found HERE

About

A lightweight library for detecting East Asian Width of Unicode characters. Useful for text layout and alignment.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages