diff options
-rw-r--r-- | src/utils/charcategory.nim | 5 | ||||
-rw-r--r-- | src/utils/strwidth.nim | 3 | ||||
-rw-r--r-- | src/utils/twtstr.nim | 2 |
3 files changed, 4 insertions, 6 deletions
diff --git a/src/utils/charcategory.nim b/src/utils/charcategory.nim index 84a63a7e..55cbb930 100644 --- a/src/utils/charcategory.nim +++ b/src/utils/charcategory.nim @@ -1,5 +1,3 @@ -import std/unicode - const C0Controls* = {chr(0x00)..chr(0x1F)} const Controls* = (C0Controls + {chr(0x7F)}) const Ascii* = {chr(0x00)..chr(0x7F)} @@ -11,6 +9,3 @@ const AsciiDigit* = {'0'..'9'} const AsciiAlphaNumeric* = AsciiAlpha + AsciiDigit const AsciiHexDigit* = (AsciiDigit + {'a'..'f', 'A'..'F'}) const AsciiWhitespace* = {' ', '\n', '\r', '\t', '\f'} - -func isDigitAscii*(r: Rune): bool = - return uint32(r) < 256 and char(r) in AsciiDigit diff --git a/src/utils/strwidth.nim b/src/utils/strwidth.nim index eb4a99d1..bcf9d034 100644 --- a/src/utils/strwidth.nim +++ b/src/utils/strwidth.nim @@ -232,6 +232,9 @@ func padToWidth*(str: string, size: int, schar = '$'): string = w += r.width result &= schar +func isDigitAscii(r: Rune): bool = + return uint32(r) < 128 and char(r) in AsciiDigit + func breaksWord*(r: Rune): bool = return not (r.isDigitAscii() or r.width() == 0 or r.isAlpha()) diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim index da9af19a..0168ad63 100644 --- a/src/utils/twtstr.nim +++ b/src/utils/twtstr.nim @@ -96,7 +96,7 @@ func camelToKebabCase*(s: string): string = result &= c func isAscii*(r: Rune): bool = - return cast[uint32](r) < 128 + return uint32(r) < 128 func startsWithNoCase*(str, prefix: string): bool = if str.len < prefix.len: return false |