about summary refs log tree commit diff stats
path: root/src/utils/twtstr.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-04-10 00:58:19 +0200
committerbptato <nincsnevem662@gmail.com>2024-04-10 00:58:19 +0200
commit213e6083a68c8d09e1a928ef5fa49983bc818ee1 (patch)
tree84def89cfd4999cbcac43a9178766b67bc3026f4 /src/utils/twtstr.nim
parent28101d383ed2f7733af0998cc4018c64a1e94e13 (diff)
downloadchawan-213e6083a68c8d09e1a928ef5fa49983bc818ee1.tar.gz
twtstr: remove isAscii, simplify onlyWhitespace
Diffstat (limited to 'src/utils/twtstr.nim')
-rw-r--r--src/utils/twtstr.nim11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index 226714d7..91f7a4ab 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -15,10 +15,7 @@ import utils/map
 export charcategory
 
 func onlyWhitespace*(s: string): bool =
-  for c in s:
-    if c notin AsciiWhitespace:
-      return false
-  return true
+  return AllChars - AsciiWhitespace notin s
 
 func isControlChar*(r: Rune): bool =
   return int(r) <= 0x1F or int(r) == 0x7F
@@ -87,12 +84,6 @@ func decValue*(c: char): int =
     return int(c) - int('0')
   return -1
 
-func isAscii*(s: string): bool =
-  for c in s:
-    if c >= char(0x80):
-      return false
-  return true
-
 const HexCharsUpper = "0123456789ABCDEF"
 const HexCharsLower = "0123456789abcdef"
 func pushHex*(buf: var string, u: uint8) =