east_asian_width 1.0.1 copy "east_asian_width: ^1.0.1" to clipboard
east_asian_width: ^1.0.1 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
points
6.97k
downloads

Publisher

verified publishermarinvitlov.com

Weekly Downloads

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