Char

GitHub   Edit on GitHub

Utilities for working with the Char type.

The Char type represents a single Unicode scalar value.

Added in 0.3.0 No other changes yet.
1
import Char from "char"

Values

Functions and constants included in the Char module.

Char.min

Added in 0.3.0 No other changes yet.
1
min : Number

The minimum valid Unicode scalar value.

Char.max

Added in 0.3.0 No other changes yet.
1
max : Number

The maximum valid Unicode scalar value.

Char.isValid

Added in 0.3.0 No other changes yet.
1
isValid : Number -> Bool

Determines whether the given character code is a valid Unicode scalar value.

Parameters:

param type description
charCode Number The number to check

Returns:

type description
Bool true if the number refers to a valid Unicode scalar value or false otherwise

Char.code

Added in 0.3.0 No other changes yet.
1
code : Char -> Number

Determines the Unicode scalar value for a character.

Parameters:

param type description
char Char The character

Returns:

type description
Number The Unicode scalar value for the given character

Char.fromCode

Added in 0.3.0 No other changes yet.
1
fromCode : Number -> Char

Creates a character from the given Unicode scalar value.

Parameters:

param type description
usv Number The Unicode scalar value

Returns:

type description
Char The character for the given Unicode scalar value

Throws:

InvalidArgument(String)

  • When the Unicode scalar value is invalid

Char.succ

Added in 0.3.0 No other changes yet.
1
succ : Char -> Char

Returns the next valid character by Unicode scalar value.

Parameters:

param type description
char Char The character

Returns:

type description
Char The next valid character by Unicode scalar value

Throws:

Failure(String)

  • When the input character is the maximum valid Unicode scalar value

Char.pred

Added in 0.3.0 No other changes yet.
1
pred : Char -> Char

Returns the previous valid character by Unicode scalar value.

Parameters:

param type description
char Char The character

Returns:

type description
Char The previous valid character by Unicode scalar value

Throws:

Failure(String)

  • When the input character is the minimum valid Unicode scalar value

Char.toString

Added in 0.3.0 No other changes yet.
1
toString : Char -> String

Converts the given character to a string.

Parameters:

param type description
char Char The character to convert

Returns:

type description
String A string containing the given character
This is a notification!