String.concat sep sl concatenates the list of strings sl, inserting the separator string sep between each.
val trim : string -> string
Return a copy of the argument, without leading and trailing whitespace. The characters regarded as whitespace are: ' ', '\012', '\n', '\r', and '\t'. If there is no leading nor trailing whitespace character in the argument, return the original string itself, not a copy.
since 4.00.0
val escaped : string -> string
Return a copy of the argument, with special characters represented by escape sequences, following the lexical conventions of OCaml. If there is no special character in the argument, return the original string itself, not a copy. Its inverse function is Scanf.unescaped.
val index : string ->char -> int
String.index s c returns the index of the first occurrence of character c in string s.
Raise Not_found if c does not occur in s.
val index_opt : string ->char ->int option
String.index_opt s c returns the index of the first occurrence of character c in string s, or None if c does not occur in s.
since 4.05
val rindex : string ->char -> int
String.rindex s c returns the index of the last occurrence of character c in string s.
Raise Not_found if c does not occur in s.
val rindex_opt : string ->char ->int option
String.rindex_opt s c returns the index of the last occurrence of character c in string s, or None if c does not occur in s.
since 4.05
val index_from : string ->int ->char -> int
String.index_from s i c returns the index of the first occurrence of character c in string s after position i. String.index s c is equivalent to String.index_from s 0 c.
Raise Invalid_argument if i is not a valid position in s. Raise Not_found if c does not occur in s after position i.
val index_from_opt : string ->int ->char ->int option
String.index_from_opt s i c returns the index of the first occurrence of character c in string s after position i or None if c does not occur in s after position i.
String.index_opt s c is equivalent to String.index_from_opt s 0 c. Raise Invalid_argument if i is not a valid position in s.
since 4.05
val rindex_from : string ->int ->char -> int
String.rindex_from s i c returns the index of the last occurrence of character c in string s before position i+1. String.rindex s c is equivalent to String.rindex_from s (String.length s - 1) c.
Raise Invalid_argument if i+1 is not a valid position in s. Raise Not_found if c does not occur in s before position i+1.
val rindex_from_opt : string ->int ->char ->int option
String.rindex_from_opt s i c returns the index of the last occurrence of character c in string s before position i+1 or None if c does not occur in s before position i+1.
String.rindex_opt s c is equivalent to String.rindex_from_opt s (String.length s - 1) c.
Raise Invalid_argument if i+1 is not a valid position in s.
since 4.05
val contains : string ->char -> bool
String.contains s c tests if character c appears in the string s.
val contains_from : string ->int ->char -> bool
String.contains_from s start c tests if character c appears in s after position start. String.contains s c is equivalent to String.contains_from s 0 c.
Raise Invalid_argument if start is not a valid position in s.
val rcontains_from : string ->int ->char -> bool
String.rcontains_from s stop c tests if character c appears in s before position stop+1.
Raise Invalid_argument if stop < 0 or stop+1 is not a valid position in s.
val uppercase : string -> string
Return a copy of the argument, with all lowercase letters translated to uppercase, including accented letters of the ISO Latin-1 (8859-1) character set.
deprecated
Functions operating on Latin-1 character set are deprecated.
val lowercase : string -> string
Return a copy of the argument, with all uppercase letters translated to lowercase, including accented letters of the ISO Latin-1 (8859-1) character set.
deprecated
Functions operating on Latin-1 character set are deprecated.
val capitalize : string -> string
Return a copy of the argument, with the first character set to uppercase, using the ISO Latin-1 (8859-1) character set..
deprecated
Functions operating on Latin-1 character set are deprecated.
val uncapitalize : string -> string
Return a copy of the argument, with the first character set to lowercase, using the ISO Latin-1 (8859-1) character set..
deprecated
Functions operating on Latin-1 character set are deprecated.
val iteri : f:(int ->char -> unit)->string -> unit
Iter on chars with their index.
since 0.12
val map : f:(char -> char)->string -> string
Map chars.
since 0.12
val mapi : f:(int ->char -> char)->string -> string
Map chars with their index.
since 0.12
val filter_map : f:(char ->char option)->string -> string
filter_map f s calls (f a0) (f a1) ... (f an) where a0 ... an are the characters of s. It returns the string of characters ci such as f ai = Some ci (when f returns None, the corresponding element of s is discarded).
since 0.17
val filter : f:(char -> bool)->string -> string
filter f s discards characters not satisfying f.
since 0.17
val flat_map : ?sep:string ->f:(char -> string)->string -> string
Map each chars to a string, then concatenates them all.
compare_versions a b compares version strings a and b, considering that numbers are above text.
since 0.13
val compare_natural : string ->string -> int
Natural Sort Order, comparing chunks of digits as natural numbers. https://en.wikipedia.org/wiki/Natural_sort_order
since 1.3
val edit_distance : string ->string -> int
Edition distance between two strings. This satisfies the classical distance axioms: it is always positive, symmetric, and satisfies the formula distance a b + distance b c >= distance a c.