Merge pull request #240 from mgold/dev
Convert Char documentation to new format.
This commit is contained in:
commit
427671acff
1 changed files with 26 additions and 11 deletions
|
@ -1,50 +1,65 @@
|
|||
|
||||
module Char where
|
||||
|
||||
{-| Functions for working with characters.
|
||||
|
||||
Like C, characters are enclosed in single quotes, and strings in double quotes.
|
||||
Like Haskell, strings are just [lists](/docs/List.elm) of characters, so `"elm"
|
||||
== ['e', 'l', 'm']`.
|
||||
|
||||
# Classification
|
||||
@docs isUpper, isLower, isDigit, isOctDigit, isHexDigit
|
||||
|
||||
# Conversion
|
||||
@docs toUpper, toLower, toLocaleUpper, toLocaleLower, toCode, fromCode
|
||||
|
||||
-}
|
||||
|
||||
import Native.Char
|
||||
|
||||
-- True for upper case letters.
|
||||
{-| True for upper case letters. -}
|
||||
isUpper : Char -> Bool
|
||||
isUpper = Native.Char.isUpper
|
||||
|
||||
-- True for lower case letters.
|
||||
{-| True for lower case letters. -}
|
||||
isLower : Char -> Bool
|
||||
isLower = Native.Char.isLower
|
||||
|
||||
-- True for ASCII digits (`0..9`).
|
||||
{-| True for ASCII digits `[0-9]`. -}
|
||||
isDigit : Char -> Bool
|
||||
isDigit = Native.Char.isDigit
|
||||
|
||||
-- True for ASCII octal digits (`0..7`).
|
||||
{-| True for ASCII octal digits `[0-7]`. -}
|
||||
isOctDigit : Char -> Bool
|
||||
isOctDigit = Native.Char.isOctDigit
|
||||
|
||||
-- True for ASCII hexadecimal digits (`0..9a..fA..F`).
|
||||
{-| True for ASCII hexadecimal digits `[0-9a-fA-F]`. -}
|
||||
isHexDigit : Char -> Bool
|
||||
isHexDigit = Native.Char.isHexDigit
|
||||
|
||||
-- Convert to upper case.
|
||||
{-| Convert to upper case. -}
|
||||
toUpper : Char -> Char
|
||||
toUpper = Native.Char.toUpper
|
||||
|
||||
-- Convert to lower case.
|
||||
{-| Convert to lower case. -}
|
||||
toLower : Char -> Char
|
||||
toLower = Native.Char.toLower
|
||||
|
||||
-- Convert to upper case, according to any locale-specific case mappings.
|
||||
{-| Convert to upper case, according to any locale-specific case mappings. -}
|
||||
toLocaleUpper : Char -> Char
|
||||
toLocaleUpper = Native.Char.toLocaleUpper
|
||||
|
||||
-- Convert to lower case, according to any locale-specific case mappings.
|
||||
{-| Convert to lower case, according to any locale-specific case mappings. -}
|
||||
toLocaleLower : Char -> Char
|
||||
toLocaleLower = Native.Char.toLocaleLower
|
||||
|
||||
type KeyCode = Int
|
||||
|
||||
-- Convert to unicode.
|
||||
{-| Convert to unicode. Used with the [`Keyboard`](/docs/Keyboard.elm)
|
||||
library, which expects the input to be uppercase. -}
|
||||
toCode : Char -> KeyCode
|
||||
toCode = Native.Char.toCode
|
||||
|
||||
-- Convert from unicode.
|
||||
{-| Convert from unicode. -}
|
||||
fromCode : KeyCode -> Char
|
||||
fromCode = Native.Char.fromCode
|
||||
|
|
Loading…
Reference in a new issue