aboutsummaryrefslogtreecommitdiffstats
path: root/src/Data/Char/Extended.hs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-01-27 23:48:42 +0100
committertv <tv@krebsco.de>2019-01-27 23:48:42 +0100
commit92ca5dbea78d4520e1cc0a3162cee2bbeb6c4c88 (patch)
tree334434c4a9fdd5123baa9203559777479ef6cbdf /src/Data/Char/Extended.hs
parent0e199f7a357a4c5973e5837ec67699cf224ca69c (diff)
Reaktor.Plugins.Mention: split using isNick
Diffstat (limited to 'src/Data/Char/Extended.hs')
-rw-r--r--src/Data/Char/Extended.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Data/Char/Extended.hs b/src/Data/Char/Extended.hs
index add079d..34d0c3e 100644
--- a/src/Data/Char/Extended.hs
+++ b/src/Data/Char/Extended.hs
@@ -1,9 +1,19 @@
module Data.Char.Extended
( module Data.Char
, isAsciiLetter
+ , isNick
) where
import Data.Char
isAsciiLetter :: Char -> Bool
-isAsciiLetter c = Data.Char.isAsciiUpper c || Data.Char.isAsciiLower c
+isAsciiLetter c = isAsciiUpper c || isAsciiLower c
+
+-- RFC1459
+isNick :: Char -> Bool
+isNick c =
+ 0x41 <= i && i <= 0x7D || -- letters / specials
+ 0x30 <= i && i <= 0x39 || -- digits
+ 0x2D == i -- minus
+ where
+ i = ord c