String
Functions for working with the built-in string type.
char_to_string
Convert a character to a one-character string.
char_to_string : char -> stringchar_to_string : char -> string
bool_to_string
Convert a boolean to a string, i.e., either "true" or "false".
bool_to_string : bool -> stringbool_to_string : bool -> string
int32_to_string
Convert an int32 value to its string representation.
int32_to_string : int32 -> stringint32_to_string : int32 -> string
float_to_string
Convert a floating-point value to its string representation.
float_to_string : float -> stringfloat_to_string : float -> string
double_to_string
Convert a double-precision value to its string representation.
double_to_string : double -> stringdouble_to_string : double -> string
to_list
Convert a string into a list of its characters.
to_list : string -> List<char>to_list : string -> List<char>
from_list
Build a string from a list of characters.
from_list : List<char> -> stringfrom_list : List<char> -> string
length
Return the number of characters in the string.
length : string -> natlength : string -> nat
is_empty
Determine whether the string is empty.
is_empty : string -> boolis_empty : string -> bool
head
Return the first character of the string, or None if empty.
head : string -> Option<char>head : string -> Option<char>
tail
Return the string without its first character.
tail : string -> stringtail : string -> string
cons
Prepend a character to the front of a string.
cons : char -> string -> stringcons : char -> string -> string
uncons
Return the head and tail of a string, as a pair.
uncons : string -> (Option<char>, string)uncons : string -> (Option<char>, string)
reverse
Reverse the characters in the string.
reverse : string -> stringreverse : string -> string
remove_whitespace
Remove all whitespace characters from the string.
remove_whitespace : string -> stringremove_whitespace : string -> string
intercalate
Insert a separator between the strings in a list and concatenate them.
intercalate : string -> List<string> -> stringintercalate : string -> List<string> -> string
concat
Take a list of strings and concatenate them into a single string.
concat : List<string> -> stringconcat : List<string> -> string
is_prefix_of
Return a boolean indicating whether the first string is a prefix of the second.
is_prefix_of : string -> string -> boolis_prefix_of : string -> string -> bool
drop
Remove the first n characters from the string.
If the string is shorter than n, return an empty string.
drop : nat -> string -> stringdrop : nat -> string -> string