A string that cannot be empty. The head and tail can be accessed without Maybes. Most other string functions are available.
Get the length of a nonempty string.
Reverse a string.
Append a string onto the beginning of a nonempty string.
Append a string onto the end of a nonempty string.
Concatenate many nonempty strings into one.
Create a nonempty string from an ordinary string, failing on the empty string.
Convert to an ordinary string.
Take a substring given a start and end index. Negative indexes are taken starting from the end of the list.
text = NonemptyString 's' "nakes on a plane!"
slice 7 9 text == "on"
slice 0 6 text == "snakes"
slice 0 -7 text == "snakes on a"
slice -6 -1 text == "plane"Take n characters from the left side of a nonempty string.
Take n characters from the right side of a nonempty string.
Drop n characters from the left side of a nonempty string.
Drop n characters from the right side of a nonempty string.
Get the first character in the nonempty string.
Return all the characters after the first one.
See if the second string contains the first one.
See if the second string starts with the first one.
See if the second string ends with the first one.
Get all of the indexes for a substring in another string.
indexes "i" (NonemptyString 'M' "ississippi") == [ 1, 4, 7, 10 ]
indexes "ss" (NonemptyString 'M' "ississippi") == [ 2, 5 ]Alias for indexes.
Try to convert a string into an int, failing on improperly formatted nonempty strings.
Convert an Int to a NonemptyString.
Try to convert a string into a float, failing on improperly formatted nonempty strings.
Convert a Float to a NonemptyString.
Create a string from a given character.
fromChar 'a' == NonemptyString 'a' ""Add a character to the beginning of a nonempty string.
Split a nonempty string into its head and tail. This lets you pattern match on strings exactly as you would with lists.
Convert a nonempty string to a nonempty list of characters.
Convert a nonempty list of characters into a nonempty string.
Cosmetic operations such as padding with extra characters or trimming whitespace.
Convert a string to all upper case. Useful for case-insensitive comparisons and VIRTUAL YELLING.
Convert a string to all lower case. Useful for case-insensitive comparisons.
Pad a nonempty string on both sides until it has a given length.
Pad a nonempty string on the left until it has a given length.
Pad a nonempty string on the right until it has a given length.
Get rid of whitespace on both sides of a nonempty string.
Get rid of whitespace on the left of a nonempty string.
Get rid of whitespace on the right of a nonempty string.
Transform every character in a nonempty string
Keep only the characters that pass the test.
Reduce a nonempty string from the left.
Reduce a nonempty string from the right.
Determine whether any characters pass the test.
Determine whether all characters pass the test.
A string with at least one character.