on 63243ca help sign in
elk/libraries/Char.elm
62 lines 1.6 kB history raw
2module Char where
4{-| Functions for working with characters. Character literals are enclosed in
5`'a'` pair of single quotes.
7# Classification
8@docs isUpper, isLower, isDigit, isOctDigit, isHexDigit
10# Conversion
11@docs toUpper, toLower, toLocaleUpper, toLocaleLower, toCode, fromCode
13-}
15import Native.Char
17{-| True for upper case letters. -}
18isUpper : Char -> Bool
19isUpper = Native.Char.isUpper
21{-| True for lower case letters. -}
22isLower : Char -> Bool
23isLower = Native.Char.isLower
25{-| True for ASCII digits `[0-9]`. -}
26isDigit : Char -> Bool
27isDigit = Native.Char.isDigit
29{-| True for ASCII octal digits `[0-7]`. -}
30isOctDigit : Char -> Bool
31isOctDigit = Native.Char.isOctDigit
33{-| True for ASCII hexadecimal digits `[0-9a-fA-F]`. -}
34isHexDigit : Char -> Bool
35isHexDigit = Native.Char.isHexDigit
37{-| Convert to upper case. -}
38toUpper : Char -> Char
39toUpper = Native.Char.toUpper
41{-| Convert to lower case. -}
42toLower : Char -> Char
43toLower = Native.Char.toLower
45{-| Convert to upper case, according to any locale-specific case mappings. -}
46toLocaleUpper : Char -> Char
47toLocaleUpper = Native.Char.toLocaleUpper
49{-| Convert to lower case, according to any locale-specific case mappings. -}
50toLocaleLower : Char -> Char
51toLocaleLower = Native.Char.toLocaleLower
53type KeyCode = Int
55{-| Convert to unicode. Used with the [`Keyboard`](/docs/Keyboard.elm)
56library, which expects the input to be uppercase. -}
57toCode : Char -> KeyCode
58toCode = Native.Char.toCode
60{-| Convert from unicode. -}
61fromCode : KeyCode -> Char
62fromCode = Native.Char.fromCode