NeteaseMusicLyricDownloader/modules/utils/length.py
1826013250 dded74a4a9 Optimize Progress Bar, again...
Fix "Changing Destination Path" bug, provided by YXRain05
2023-04-30 22:14:52 +08:00

12 lines
338 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""一些有关计算长度的工具"""
def get_more_length(content):
"""将相对于正常长度的超出值返回"""
return (len(content.encode("utf-8")) - len(content)) // 2
def len_abs(content):
"""针对中文将一个汉字识别为2个长度而不是1个"""
return len(content) + get_more_length(content)