CCStringLabelstype 'a klist = unit -> [ `Nil | `Cons of 'a * 'a klist ]module type S = sig ... endinclude module type of struct include StringLabels endString.get s n returns the character at index n in string s. You can also write s.[n] instead of String.get s n.
Raise Invalid_argument if n not a valid index in s.
String.create n returns a fresh byte sequence of length n. The sequence is uninitialized and contains arbitrary bytes.
Raise Invalid_argument if n < 0 or n > Sys.max_string_length.
String.make n c returns a fresh string of length n, filled with the character c.
Raise Invalid_argument if n < 0 or n > Sys.max_string_length.
String.sub s start len returns a fresh string of length len, containing the substring of s that starts at position start and has length len.
Raise Invalid_argument if start and len do not designate a valid substring of s.
String.fill s start len c modifies byte sequence s in place, replacing len bytes by c, starting at start.
Raise Invalid_argument if start and len do not designate a valid substring of s.
String.concat sep sl concatenates the list of strings sl, inserting the separator string sep between each.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
String.contains s c tests if character c appears in the string s.
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.
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.
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.
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.
Return a copy of the argument, with the first character set to uppercase, using the ISO Latin-1 (8859-1) character set..
Return a copy of the argument, with the first character set to lowercase, using the ISO Latin-1 (8859-1) character set..
pad n str ensures that str is at least n bytes long, and pads it on the side with c if it's not the case.
val of_gen : char gen -> stringConvert a gen of characters to a string.
val of_iter : char iter -> stringConvert a iter of characters to a string.
val of_std_seq : char Seq.t -> stringConvert a sequence of characters to a string.
val of_seq : char sequence -> stringval of_klist : char klist -> stringFind sub in string, returns its first index or -1.
val find_all : ?start:int -> sub:string -> string -> int genfind_all ~sub s finds all occurrences of sub in s, even overlapping instances.
find_all_l ~sub s finds all occurrences of sub in s and returns them in a list.
Find sub in string from the right, returns its first index or -1. Should only be used with very small sub.
replace ~sub ~by s replaces some occurrences of sub by by in s.
is_sub ~sub i s j ~len returns true iff the substring of sub starting at position i and of length len is a substring of s starting at position j.
chop_prefix ~pre s removes pre from s if pre really is a prefix of s, returns None otherwise.
chop_suffix ~suf s removes suf from s if suf really is a suffix of s, returns None otherwise.
val lines_gen : string -> string genlines_gen s returns a generator of the lines of s (splits along '\n').
val concat_gen : sep:string -> string gen -> stringconcat_gen ~sep g concatenates all strings of g, separated with sep.
val unlines_gen : string gen -> stringunlines_gen g concatenates all strings of g, separated with '\n'.
set s i c creates a new string which is a copy of s, except for index i, which becomes c.
Alias to String.iter.
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).
Map each chars to a string, then concatenates them all.
include S with type t := stringval blit :
src:string ->
src_pos:int ->
dst:Bytes.t ->
dst_pos:int ->
len:int ->
unitLike String.blit. Compatible with the -safe-string option.
val to_gen : string -> char genReturn the gen of characters contained in the string.
val to_iter : string -> char iterReturn the iter of characters contained in the string.
val to_std_seq : string -> char Seq.tto_std_seq s returns a Seq.t of the bytes in s.
val to_seq : string -> char sequenceval to_klist : string -> char klistval pp_buf : Buffer.t -> string -> unitRenamed from pp since 2.0.
val pp : Format.formatter -> string -> unitPrint the string within quotes.
Renamed from print since 2.0.
drop_while f s discards any characters starting from the left, up to the first character c not satisfying f c.
rdrop_while f s discards any characters starting from the right, up to the first character c not satisfying f c.
Trim space on the left (see String.trim for more details).
Trim space on the right (see String.trim for more details).
Iterate on pairs of chars with their index.
Fold on pairs of chars.
All pairs of chars respect the predicate?
Those functions are deprecated in String since 4.03, so we provide a stable alias for them even in older versions.
See String.
See String.
See String.
See String.
A relatively efficient algorithm for finding sub-strings.
module Find : sig ... endmodule Split : sig ... endAlias to Split.list_cpy.
compare_versions a b compares version strings a and b, considering that numbers are above text.
Natural Sort Order, comparing chunks of digits as natural numbers. https://en.wikipedia.org/wiki/Natural_sort_order
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.
A contiguous part of a string
module Sub : sig ... end