MCPcopy Create free account
hub / github.com/bytedance/sonic-cpp / str_width

Function str_width

scripts/tools/draw-png.py:173–174  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

171def wide_chars(s):
172 return sum(unicodedata.east_asian_width(x) =='W' for x in s)
173def str_width(s):
174 return len(s) + wide_chars(s)
175
176def draw_in_text(encode_percentage, decode_percentage, encode_cputime, decode_cputime, names):
177 yellow = "\x1b[33;21m"

Callers 1

draw_in_textFunction · 0.85

Calls 1

wide_charsFunction · 0.85

Tested by

no test coverage detected