MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / get_string_display_width

Method get_string_display_width

script/btcli.py:98–104  ·  view source on GitHub ↗

获取字符串的实际显示宽度

(s)

Source from the content-addressed store, hash-verified

96
97 @staticmethod
98 def get_string_display_width(s):
99 """获取字符串的实际显示宽度"""
100 width = 0
101 s = Colors.remove_color(s)
102 for char in s:
103 width += TablePrinter.get_char_width(char)
104 return width
105
106 @staticmethod
107 def pad_string_with_chinese(s, target_width):

Callers 2

print_tableMethod · 0.80

Calls 2

remove_colorMethod · 0.80
get_char_widthMethod · 0.80

Tested by

no test coverage detected