east_asian_width 1.0.0 copy "east_asian_width: ^1.0.0" to clipboard
east_asian_width: ^1.0.0 copied to clipboard

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

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

0
likes
160
pub points
19%
popularity

Publisher

verified publishermarinvitlov.com

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

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on east_asian_width