File tree Expand file tree Collapse file tree 4 files changed +35
-6
lines changed Expand file tree Collapse file tree 4 files changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -26,4 +26,20 @@ fromCharCode :: Int -> Char
2626
2727Constructs a character from the given Unicode numeric value.
2828
29+ #### ` toLowerChar `
30+
31+ ``` purescript
32+ toLowerChar :: Char -> Char
33+ ```
34+
35+ Converts a character to lowercase.
36+
37+ #### ` toUpperChar `
38+
39+ ``` purescript
40+ toUpperChar :: Char -> Char
41+ ```
42+
43+ Converts a character to uppercase.
44+
2945
Original file line number Diff line number Diff line change @@ -198,8 +198,9 @@ of the string for which the predicate holds.
198198split :: String -> String -> Array String
199199```
200200
201- Returns the substrings of the first string separated along occurences
202- of the second string.
201+ Returns the substrings of the second string separated along occurences
202+ of the first string.
203+ * ` split " " "hello world" == ["hello", "world"] `
203204
204205#### ` toCharArray `
205206
Original file line number Diff line number Diff line change @@ -14,3 +14,11 @@ exports.toCharCode = function (c) {
1414exports . fromCharCode = function ( c ) {
1515 return String . fromCharCode ( c ) ;
1616} ;
17+
18+ exports . toLowerChar = function ( c ) {
19+ return c . toLowerCase ( ) ;
20+ } ;
21+
22+ exports . toUpperChar = function ( c ) {
23+ return c . toUpperCase ( ) ;
24+ } ;
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ module Data.Char
33 ( toString
44 , fromCharCode
55 , toCharCode
6+ , toLowerChar
7+ , toUpperChar
68 ) where
79
810import Prelude
@@ -16,11 +18,13 @@ foreign import toCharCode :: Char -> Int
1618-- | Constructs a character from the given Unicode numeric value.
1719foreign import fromCharCode :: Int -> Char
1820
21+ -- | Converts a character to lowercase.
22+ foreign import toLowerChar :: Char -> Char
23+
24+ -- | Converts a character to uppercase.
25+ foreign import toUpperChar :: Char -> Char
26+
1927-- | Characters fall within the Unicode range.
2028instance boundedChar :: Bounded Char where
2129 top = fromCharCode zero
2230 bottom = fromCharCode 65535
23-
24- -- | Characters can be rendered as a string with `show`.
25- instance showChar :: Show Char where
26- show c = " Char " ++ show (toString c)
You can’t perform that action at this time.
0 commit comments