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