From fb2f0b91ae59612495143982212f3def20d3bf68 Mon Sep 17 00:00:00 2001 From: bptato Date: Sat, 27 Jan 2024 01:38:23 +0100 Subject: mimetypes: simplify parseMimeTypes * use functions like until * do not call atEnd for every line, use boolean readLine instead --- src/utils/twtstr.nim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/utils/twtstr.nim') diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim index f1af1998..1584f3f5 100644 --- a/src/utils/twtstr.nim +++ b/src/utils/twtstr.nim @@ -205,6 +205,12 @@ func until*(s: string, c: set[char], starti = 0): string = break result.add(s[i]) +func untilLower*(s: string, c: set[char], starti = 0): string = + for i in starti ..< s.len: + if s[i] in c: + break + result.add(s[i].toLowerAscii()) + func until*(s: string, c: char, starti = 0): string = s.until({c}, starti) -- cgit 1.4.1-2-gfad0