diff options
author | bptato <nincsnevem662@gmail.com> | 2023-01-06 22:24:40 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-01-06 22:24:40 +0100 |
commit | 04bde8da293557c29ea24181708cecdce922e9bc (patch) | |
tree | a67e18a342684c23157d28430ed339d3480cdcac /src/utils | |
parent | 8323cf214819297cae0ce0908e339a78a289434a (diff) | |
download | chawan-04bde8da293557c29ea24181708cecdce922e9bc.tar.gz |
utils/twtstr: simplify mnormalize
Use the isAscii function for early return.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/twtstr.nim | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim index 5a5d5819..582d68d4 100644 --- a/src/utils/twtstr.nim +++ b/src/utils/twtstr.nim @@ -555,10 +555,7 @@ proc mnormalize*(rs: var seq[Rune], form = UNICODE_NFC) = {.cast(noSideEffect).} #TODO maybe a utf8 normalization procedure? proc mnormalize*(s: var string) = - block do_nothing: - for c in s: - if c notin Ascii: - break do_nothing + if s.isAscii(): return # no need to normalize ascii var rs = s.toRunes() rs.mnormalize() |