bilibilivoice.scrollstring - 字符串滚动¶
-
bilibilivoice.scrollstring.
truelen
(string)[源代码]¶ It appears one Asian character takes two spots, but __len__ counts it as three, so this function counts the dispalyed length of the string.
将汉字的所占的长度进行重新地换算,因为单纯地用Python自带的长度计算方法有 错误
>>> truelen('abc') 3 >>> truelen('你好') 4 >>> truelen('1二3') 4 >>> truelen('') 0