Strings

manimlib/utils/strings.py 这个文件中主要实现了处理字符串的函数


manimlib.utils.strings.to_camel_case(name)

将 name 转化为驼峰命名(应该会报错)


manimlib.utils.strings.initials(name, sep_values=[' ', '_'])

获取 name 中每个单词的首字母


manimlib.utils.strings.camel_case_initials(name)

获取 name 中的大写字母


manimlib.utils.strings.complex_string(complex_num)

获取 complex_num 的每一个字符,括号除外


manimlib.utils.strings.split_string_to_isolate_substrings(full_string, *isolate)

Given a string, and an arbitrary number of possible substrings, to isolate, this returns a list of strings which would concatenate to make the full string, and in which these special substrings appear as their own elements.

For example,split_string_to_isolate_substrings(“to be or not to be”, “to”, “be”) would return [“to”, ” “, “be”, ” or not “, “to”, ” “, “be”]

给出一个完整字符串,和一系列可能包含的字符串
将完整字符串分割,若出现可能包含的字符串,则将其分离
  • 例: split_string_to_isolate_substrings("to be or not to be", "to", "be") 会返回 ["to", " ", "be", " or not ", "to", " ", "be"]