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, *substrings_to_isolate)

Given a string, and an arbitrary number of possible substrings, 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"]


manimlib.utils.strings.split_string_list_to_isolate_substrings(string_list, *substrings_to_isolate)

Similar to split_string_to_isolate_substrings, but the first argument is a list of strings, thought of as something already broken up a bit.

对string_list中每个字符串都执行 split_string_to_isolate_substrings(full_string, *substrings_to_isolate)