PONYO_STRING

typet:string
valall:string -> (char -> bool) -> bool
This returns true if each character in the given string passes the given test.
Examples:
all ("Ponyo", Char.isDigit)   = false
all ("0x12", Char.isAlphaNum) = true
valcapitalize:string -> string
This converts the first character of the string to uppercase and the rest of the characters to lowercase.
Examples:
capitalize ("ponyo") = "Ponyo"
capitalize ("pOnYo") = "Ponyo"
valcharAt:string * int -> char
This returns the character at the given index of the given string. If the index is below zero, the index is added to the length and this becomes the new index. This is repeated until the index is greater-than or equal-to zero. Attempting to get a character at an index greater than the length of the string results in an IndexError.
Examples:
charAt ("ponyo.org", 0)   = #"p"
charAt ("ponyo.org", 1)   = #"o"
charAt ("ponyo.org", ~1)  = #"g"
charAt ("ponyo.org", ~11) = #"r"
valcompare:string * string -> order
This returns LESS, GREATER, or EQUAL by comparing each character of the given strings.
Examples:
compare ("ponyo.org", "qq.com")     = GREATER
compare ("ponyo.org", "reddit.com") = LESS
compare ("ponyo.org", "ponyo.org")  = EQUAL
valcount:string * string -> int
This returns the number of times the given substring occurs in the given string.
Examples:
count ("http://ponyo.org", ":")   = 1
count ("http://ponyo.org", "//")  = 1
count ("http://ponyo.org", "org") = 1
valexplode:string -> char list
This converts a string to a list of characters.
Examples:
explode ("ponyo") = [#"p", #"o", #"n", #"y", #"o"]
valfromChar:char -> string
This converts a character to a string.
Examples:
fromChar (#"p") = "p"
valhasPrefix:string * string -> bool
This returns true if the given string begins with the given substring.
Examples:
hasPrefix ("http://www.google.com", "http://") = true
hasPrefix ("http://www.google.com", "www")     = false
valhasSuffix:string * string -> bool
This returns true if the given string ends with the given substring.
Examples:
hasSuffix ("http://www.google.com", ".com") = true
hasSuffix ("http://ponyo.org", ".com")      = false
valimplode:char list -> string
This converts a list of characters to a string.
Examples:
implode [#"p", #"o", #"n", #"y", #"o"] = "ponyo"
valindexOf:string * string -> int
This returns the first index of the given substring in the given string or negative one if the substring does not exist.
Examples:
indexOf ("http://google.com", ":")  = 4
indexOf ("http://ponyo.org", "com") = ~1
valindexOfFrom:string * string * int -> int
This returns the first index of the given substring in the given string or negative one if the substring does not exist and starts at the given index.
Examples:
indexOfFrom ("http://google.com:80", ":", 5) = 17
indexOfFrom ("http://google.com", "com", 14) = ~1
valisAlphaNum:string -> bool
This returns true if all characters within the given string are alphanumeric.
Examples:
isAlphaNum ("0x12") = true
isAlphaNum ("abc!") = false
valisChar:string -> bool
This returns true if the string has only one character.
valisDigit:string -> bool
This returns true if all characters in the string are digits between zero and nine.
valisLower:string -> bool
This returns true if all characters in the string are lowercase.
valisUpper:string -> bool
This returns true if all characters in the string are uppercase.
valjoin:string list * string -> string
This concatenates each string in the given list by the given glue.
Examples:
join (["ponyo", ".", "org"], "") = "ponyo.org"
vallength:string -> int
This returns the number of characters in the string.
valmap:string -> (char -> char) -> string
This returns a new string from the given string by converting each character of the given string by the given conversion.
Examples:
map ("ponyo.org", (fn c => "-")) = "---------"
valreplace:string * string * string -> string
This returns a new string from the given string by replacing every instance of the first substring with the second.
Examples:
replace ("structure C =\\nstruct\\end", "\\n", " ") = "structure C = struct end"
valreverse:string -> string
valsplitN:string * string * int -> string list
This splits the first string by the second at most n times.
Examples:
splitN ("http://www.ponyo.org", ".", 1) = ["http://www", "ponyo.org"]
splitN ("http://www.ponyo.org", ".", 3) = ["http://www", "ponyo", "org"]
valsplit:string * string -> string list
This splits the first string by the second as many times as possible.
Examples:
split ("ponyo.org", ".") = ["ponyo", "org"]
valstripLeft:string * string -> string
This removes all occurences of the second string in the first string on the left-hand side.
Examples:
stripLeft ("  ponyo.org  ", " ") = "ponyo.org  "
valstripRight:string * string -> string
This removes all occurences of the second string in the first string on the right-hand side.
Examples:
stripRight ("  ponyo.org  ", " ") = "  ponyo.org"
valstrip:string * string -> string
This removes all occurences of the second string in the first string on both sides.
Examples:
strip ("  ponyo.org  ", " ") = "ponyo.org"
valstripAll:string * string list -> string
This removes all occurences of any of the given substrings in the given string as many times as possible.
Examples:
stripAll ("  \\t ponyo.org \\n", [" ", "\\t", "\\n"]) = "ponyo.org"
valstripWhitespace:string -> string
This removes all occurences of white space from both sides of the string according to stripAll. Whitespace is defined by the WS value.
valsubstring:string * int * int -> string
This returns the section of the given string starting with the first index and includes the next n characters.
Examples:
substring ("ponyo.org", 0, 1) = "p"
substring ("ponyo.org", 2, 3) = "nyo"
valsubstringToEnd:string * int -> string
This returns the section of the given string starting at the given index and ending at the end of the original string.
Examples:
substringToEnd ("ponyo.org", 5) = ".org")
valtoChar:string -> char
This returns the first character of the string.
Examples:
toChar ("p")         = #"p"
toChar ("ponyo.org") = #"p"
valtoLower:string -> string
This converts the given string to lowercase.
valtoTitle:string -> string
This converts the first letter of each space-delimited substring of the given string to uppercase and the rest of the characters to lowercase.
Examples:
toTitle ("ponyo is fun!") = "Ponyo Is Fun!"
toTitle ("PONYO is FUN!") = "Ponyo Is Fun!"
valtoUpper:string -> string
This converts the given string to uppercase.