Module

Data.Char.Utils

Package
purescript-stringutils
Repository
menelaos/purescript-stringutils

#fromCodePoint Source

fromCodePoint :: Int -> Maybe String

DEPRECATED: With the adoption of CodePoints in purescript-strings, this function can now be reproduced via map Data.String.singleton <<< toEnum. In order to keep the string-related API surface area small, this function will probably be removed at some point.

Return the character corresponding to the given Unicode code point and Nothing if the given number is outside the range 0 .. 0x10FFFF. This function uses String instead of Char because PureScript Chars must be UTF-16 code units and hence cannot represent all Unicode code points.

#isSurrogate Source

isSurrogate :: String -> Boolean

Return true if the given character (Unicode code point) is a high or low surrogate code point. This function uses String instead of Char because PureScript Chars must be UTF-16 code units and hence cannot represent all Unicode code points.

#toCodePoint Source

toCodePoint :: String -> Int

Return the Unicode code point of a character. This function uses String instead of Char because PureScript Chars must be UTF-16 code units and hence cannot represent all Unicode code points.

Example:

toCodePoint '∀' == 8704

#unsafeFromCodePoint Source

unsafeFromCodePoint :: Int -> String

Return the character corresponding to the given Unicode code point. Unsafe: Throws runtime exception if the given number is outside the range 0 .. 0x10FFFF. This function uses String instead of Char because PureScript Chars must be UTF-16 code units and hence cannot represent all Unicode code points.