mirror of
https://github.com/3b1b/manim.git
synced 2025-07-29 21:12:35 +08:00
Refactored helpers.py into a folder of various util files
This commit is contained in:
19
utils/strings.py
Normal file
19
utils/strings.py
Normal file
@ -0,0 +1,19 @@
|
||||
import re
|
||||
import string
|
||||
|
||||
def to_camel_case(name):
|
||||
return "".join([
|
||||
filter(
|
||||
lambda c : c not in string.punctuation + string.whitespace, part
|
||||
).capitalize()
|
||||
for part in name.split("_")
|
||||
])
|
||||
|
||||
def initials(name, sep_values = [" ", "_"]):
|
||||
return "".join([
|
||||
(s[0] if s else "")
|
||||
for s in re.split("|".join(sep_values), name)
|
||||
])
|
||||
|
||||
def camel_case_initials(name):
|
||||
return filter(lambda c : c.isupper(), name)
|
Reference in New Issue
Block a user