Splits a character list into a list of whitespace separated character lists.
words' (unpack " A B C D E ")
Splits a string into a list of whitespace separated strings.
words " A B C D E "
Joins the character lists by spaces into a single character list.
unwords' [['A'], ['B', 'C'], ['D'], ['E']]
Joins the strings by spaces into a single string.
unwords ["A", "BC", "D", "E"]
Turns a string into a list of characters.
unpack "ABC"
Joins the character lists by newlines into a single character list.
unlines' [['l','i','n','e'], ['l','i','n','e','2'], ['l','n','3'], ['D']]
Joins the strings by newlines into a single string.
unlines ["line", "line2", "ln3", "D"]
Removes whitespace (determined with 'isSpace') from
the start and end of the string.
trim " A\nB C "
Uppercases all characters in the string.
toLower "aBc12!"
Lowercases all characters in the string.
toLower "aBc12!"
Returns a substring of a given string
The (zero based) index of the string to extract. If this is
beyond the end of the string, the function returns the empty
string.
The desired length of the substring. Truncated if this exceeds
the length of the input.
The string to return a portion of
Version of 'strTail' that statically verifies that the string is not empty.
Returns the characters specified after the head of the string.
Doesn't work for empty strings.
strTail "AB"
strTail "A"
Returns the nth character (starting from 0) of the specified string.
Precondition: '0 < i < length s' for 'strIndex s i'.
strIndex "AB" 1
Version of 'strHead' that statically verifies that the string is not empty.
Returns the first character in the specified string.
Doesn't work for empty strings.
strHead "A"
Adds a character to the front of the specified string.
strCons 'A' "B"
strCons 'A' ""
Splits the string into parts with the predicate
indicating separator characters.
split (== '.') ".AB.C..D"
Splits the string into a part before the predicate
returns False and the rest of the string.
span (/= 'C') "ABCD"
span (/= 'C') "EFGH"
Creates a string of a single character.
singleton 'A'
Reverses the elements within a String.
reverse "ABC"
reverse ""
Turns a Foldable of characters into a string.
Check if a supposed string was actually a null pointer
Check if a foreign pointer is null
Create a buffer for a string with maximum length len
Removes whitespace (determined with 'isSpace') from
the start of the string.
ltrim " A\nB"
ltrim " \nAB"
Splits a character list into a list of newline separated character lists.
lines' (unpack "\rA BC\nD\r\nE\n")
Splits a string into a list of newline separated strings.
lines "\rA BC\nD\r\nE\n"
Returns the length of the string.
length ""
length "ABC"
Get the string from a string buffer. The buffer is invalid after
this.
Splits the string into a part before the predicate
returns True and the rest of the string.
break (== 'C') "ABCD"
break (== 'C') "EFGH"
Append a string to the end of a string buffer
A preallocated buffer for building a String. This allows a function (in IO)
to allocate enough space for a stirng which will be build from smaller
pieces without having to allocate at every step.
To build a string using a StringBuffer
, see newStringBuffer
,
addToStringBuffer
and getStringFromBuffer
.
Appends two strings together.
"AB" ++ "C"