Project setup
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
|
||||
import re
|
||||
|
||||
|
||||
def slugify(input : str) -> str:
|
||||
s = input.lower()
|
||||
s = re.sub(r'\s+', '_', s)
|
||||
s = re.sub(r'[^a-z0-9_]+', '', s)
|
||||
s = re.sub(r'_+', '_', s)
|
||||
s = s.strip('_')
|
||||
if not s:
|
||||
s = 'buttonplus'
|
||||
while len(s) > 1 and s[0].isdigit():
|
||||
s = s[1:]
|
||||
return s
|
||||
Reference in New Issue
Block a user