string_width

Creator: coderz1093

Last updated:

0 purchases

string_width Image
string_width Images

Languages

Categories

Add to Cart

Description:

string width

string_width #

Get the visual width of a string - the number of columns required to display it

Some Unicode characters are fullwidth and use double the normal width. ANSI escape codes are stripped and doesn't affect the width.
Useful to be able to measure the actual width of command-line output.
Install #
$ dart pub add string_width
copied to clipboard
Usage #
import 'package:string_width/string_width.dart';

void main() {
print(stringWidth('a'));
//=> 1

print(stringWidth('古'));
//=> 2

print(stringWidth('\u001B[1m古\u001B[22m'));
//=> 2
}

copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.