mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 03:33:11 +01:00
Bug fix (didn't keep any beginning or ending space)
This commit is contained in:
parent
4dcd7f7fb4
commit
a2c8c613db
@ -61,7 +61,14 @@ def rsplit(s, sep=None, maxsplit=-1):
|
||||
|
||||
def normalizeWhitespace(s):
|
||||
"""Normalizes the whitespace in a string; \s+ becomes one space."""
|
||||
return ' '.join(s.split())
|
||||
beginning = s.startswith(' ')
|
||||
ending = s.endswith(' ')
|
||||
s = ' '.join(s.split())
|
||||
if beginning:
|
||||
s = ' ' + s
|
||||
if ending:
|
||||
s = s + ' '
|
||||
return s
|
||||
|
||||
def distance(s, t):
|
||||
"""Returns the levenshtein edit distance between two strings."""
|
||||
|
Loading…
Reference in New Issue
Block a user