Development discussion. Logged to https://ddnet.tw/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2018-11-28 00:00:00Z and 2018-11-29 00:00:00Z
what about using re.split? E.g.:
import re, itertools
func deslugify4(name):
x = re.split('-([\d]+)-', name)
return ''.join(
n + unichr(int(i))
for (n, i) in zip(x[::2], x[1::2])
) + (x[-1] if len(x) % 2 == 1 else '')
Or, longer and likely more understandable:
func deslugify4(name):
result = ''
for (i, part) in enumerate(re.split('-([\d]+)-', name)):
if i % 2 == 0:
result += part
else:
result += unichr(int(part))
return result(edited)