about summary refs log tree commit diff stats
path: root/src/utils
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-07-17 22:31:04 +0200
committerbptato <nincsnevem662@gmail.com>2022-07-17 22:31:04 +0200
commit24fc8e940a935f0579cf7bc03bf01e27e5853b80 (patch)
tree8590acda7c4bd8f856e2869ed35a804116926f0d /src/utils
parent7cdb8c1b679431b1be52c9fbb19b67445a0bb588 (diff)
downloadchawan-24fc8e940a935f0579cf7bc03bf01e27e5853b80.tar.gz
Implement select element display
You can't actually use them yet. But at least they don't flood the
screen with options now.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/twtstr.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index 00f56905..4937d0be 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -582,6 +582,18 @@ func unicodeToAscii*(s: string, checkhyphens, checkbidi, checkjoiners, transitio
       labels.add(label)
   return labels.join('.').some
 
+func isValidNonZeroInt*(str: string): bool =
+  if str.len == 0: return false
+  if str == "0": return false
+  for c in str:
+    if not c.isDigit():
+      return false
+  try:
+    discard parseInt(str)
+  except ValueError:
+    return false
+  true
+
 proc expandPath*(path: string): string =
   if path.len == 0:
     return path