geriou-bir/grids/utils.py
2023-09-22 08:19:18 +02:00

21 lines
483 B
Python

import re
def split_word(word):
if word == "":
return []
else:
index_cscrabh = [match.start() for match in re.finditer("c'h", word.lower())]
print(index_cscrabh)
list_chars = []
i = 0
while i < len(word):
if i in index_cscrabh:
list_chars.append(word[i : i + 3])
i += 3
else:
list_chars.append(word[i])
i += 1
return list_chars