Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
    Page
Library
Module
Module type
Parameter
Class
Class type
Source
Standard.CharFunctions for working with single characters.
You can create a Char using single quotes:
let char = 'c'Convert an ASCII code point to a character.
Returns None if the codepoint is outside the range of 0 to 255 inclusive.
Examples
Char.ofCode 65 = Some 'A'Char.ofCode 66 = Some 'B'Char.ofCode 3000 = NoneChar.ofCode (-1) = NoneThe full range of extended ASCII is from 0 to 255. For numbers outside that range, you get None.
Converts a string to a character.
Returns None when the string isn't of length one.
Examples
Char.ofString "A" = Some 'A'Char.ofString " " = Some ' 'Char.ofString "" = NoneChar.ofString "abc" = NoneChar.ofString " a" = NoneDetect lower case ASCII characters.
Examples
Char.isLowercase 'a' = trueChar.isLowercase '0' = falseChar.isLowercase 'A' = falseChar.isLowercase '-' = falseDetect upper case ASCII characters.
Examples
Char.isUppercase 'A' = trueChar.isUppercase 'h' = falseChar.isUppercase '0' = falseChar.isUppercase '-' = falseDetect upper and lower case ASCII alphabetic characters.
Examples
Char.isLetter 'a' = trueChar.isLetter 'E' = trueChar.isLetter '0' = falseChar.isLetter '-' = falseDetect when a character is a number
Examples
Char.isDigit '0' = trueChar.isDigit '9' = trueChar.isDigit 'a' = falseChar.isDigit '-' = falseDetect upper case, lower case and digit ASCII characters.
Examples
Char.isAlphanumeric 'a' = trueChar.isAlphanumeric 'E' = trueChar.isAlphanumeric '0' = trueChar.isAlphanumeric '-' = falseDetect if a character is a printable character
A Printable character has a Char.toCode in the range 32 to 127, inclusive (' ' to '~').
Examples
Char.isPrintable 'G' = trueChar.isPrintable '%' = trueChar.isPrintable ' ' = trueChar.isPrintable '\t' = falseChar.isPrintable '\007' = falseDetect one of the following characters:
'\t' (tab)'\n' (newline)'\011' (vertical tab)'\012' (form feed)'\r' (carriage return)' ' (space)Examples
Char.isWhitespace '\t' = trueChar.isWhitespace ' ' = trueChar.isWhitespace '?' = falseChar.isWhitespace 'G' = falseConverts an ASCII character to lower case, preserving non alphabetic ASCII characters.
Examples
Char.toLowercase 'A' = 'a'Char.toLowercase 'B' = 'b'Char.toLowercase '7' = '7'Convert an ASCII character to upper case, preserving non alphabetic ASCII characters.
Examples
toUppercase 'a' = 'A'toUppercase 'b' = 'B'toUppercase '7' = '7'Convert a character into a string.
Examples
Char.toString 'A' = "A"Char.toString '{' = "{"Char.toString '7' = "7"Converts a digit character to its corresponding Int.
Returns None when the character isn't a digit.
Examples
Char.toDigit "7" = Some 7Char.toDigit "0" = Some 0Char.toDigit "A" = NoneChar.toDigit "" = NoneTest two Chars for equality
Compare two Chars
The unique identity for chars Comparator
val comparator : (char, identity) Standard__.Core.Comparator.t