module CCString:sig..end
Consider using Containers_string.KMP for pattern search, or Regex
libraries.
type'agen =unit -> 'a option
type'asequence =('a -> unit) -> unit
type'aklist =unit -> [ `Cons of 'a * 'a klist | `Nil ]
module type S =sig..end
val equal : string -> string -> bool
val compare : string -> string -> int
val hash : string -> int
val init : int -> (int -> char) -> stringArray.init.val rev : string -> stringrev s returns the reverse of sval pad : ?side:[ `Left | `Right ] -> ?c:char -> int -> string -> stringpad 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.side : determines where padding occurs (default: `Left)c : the char used to pad (default: ' ')val of_char : char -> stringof_char 'a' = "a"val of_gen : char gen -> string
val of_seq : char sequence -> string
val of_klist : char klist -> string
val of_list : char list -> string
val of_array : char array -> string
val to_array : string -> char array
val find : ?start:int -> sub:string -> string -> intsub in string, returns its first index or -1.
Should only be used with very small subval find_all : ?start:int -> sub:string -> string -> int gen find_all ~sub s finds all occurrences of sub in s, even overlapping
instances.start : starting position in sval find_all_l : ?start:int -> sub:string -> string -> int listfind_all ~sub s finds all occurrences of sub in s and returns
them in a liststart : starting position in sval mem : ?start:int -> sub:string -> string -> boolmem ~sub s is true iff sub is a substring of sval rfind : sub:string -> string -> intsub in string from the right, returns its first index or -1.
Should only be used with very small subval replace : ?which:[ `All | `Left | `Right ] ->
sub:string -> by:string -> string -> stringreplace ~sub ~by s replaces some occurrences of sub by by in sInvalid_argument if sub = ""which : decides whether the occurrences to replace are:
`Left first occurrence from the left (beginning)`Right first occurrence from the right (end)`All all occurrences (default)val is_sub : sub:string -> int -> string -> int -> len:int -> boolis_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 jval repeat : string -> int -> stringval prefix : pre:string -> string -> boolprefix ~pre s returns true iff pre is a prefix of sval suffix : suf:string -> string -> boolsuffix ~suf s returns true iff suf is a suffix of sval chop_prefix : pre:string -> string -> string optionchop_pref ~pre s removes pre from s if pre really is a prefix
of s, returns None otherwiseval chop_suffix : suf:string -> string -> string optionchop_suffix ~suf s removes suf from s if suf really is a suffix
of s, returns None otherwiseval take : int -> string -> stringtake n s keeps only the n first chars of sval drop : int -> string -> stringdrop n s removes the n first chars of sval take_drop : int -> string -> string * stringtake_drop n s = take n s, drop n sval lines : string -> string listlines s returns a list of the lines of s (splits along '\n')val lines_gen : string -> string gen lines_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 : string list -> stringunlines l concatenates all strings of l, separated with '\n'val unlines_gen : string gen -> stringunlines_gen g concatenates all strings of g, separated with '\n'val set : string -> int -> char -> stringset s i c creates a new string which is a copy of s, except
for index i, which becomes c.Invalid_argument if i is an invalid indexval iter : (char -> unit) -> string -> unitString.iterval iteri : (int -> char -> unit) -> string -> unitval map : (char -> char) -> string -> stringval mapi : (int -> char -> char) -> string -> stringval filter_map : (char -> char option) -> string -> stringval filter : (char -> bool) -> string -> stringval flat_map : ?sep:string -> (char -> string) -> string -> stringsep : optional separator between each generated stringval for_all : (char -> bool) -> string -> boolval exists : (char -> bool) -> string -> boolinclude CCString.S
val map2 : (char -> char -> char) -> string -> string -> stringInvalid_argument if the strings have not the same lengthval iter2 : (char -> char -> unit) -> string -> string -> unitInvalid_argument if the strings have not the same lengthval iteri2 : (int -> char -> char -> unit) -> string -> string -> unitInvalid_argument if the strings have not the same lengthval fold2 : ('a -> char -> char -> 'a) -> 'a -> string -> string -> 'aInvalid_argument if the strings have not the same lengthval for_all2 : (char -> char -> bool) -> string -> string -> boolInvalid_argument if the strings have not the same lengthval exists2 : (char -> char -> bool) -> string -> string -> boolInvalid_argument if the strings have not the same length
Those functions are deprecated in String since 4.03, so we provide
a stable alias for them even in older versions
val capitalize_ascii : string -> stringString.val uncapitalize_ascii : string -> stringString.val uppercase_ascii : string -> stringString.val lowercase_ascii : string -> stringString.
A relatively efficient algorithm for finding sub-strings
module Find:sig..end
module Split:sig..end
val compare_versions : string -> string -> intcompare_versions a b compares version strings a and b,
considering that numbers are above text.val edit_distance : string -> string -> intdistance a b + distance b c >= distance a cmodule Sub:sig..end