Module Unprime_string.String
include module type of Stdlib.String
val length : string -> intval get : string -> int -> charval set : bytes -> int -> char -> unitval create : int -> bytes
val make : int -> char -> stringval init : int -> (int -> char) -> stringval copy : string -> stringval sub : string -> int -> int -> stringval fill : bytes -> int -> int -> char -> unitval blit : string -> int -> bytes -> int -> int -> unitval concat : string -> string list -> stringval iter : (char -> unit) -> string -> unitval iteri : (int -> char -> unit) -> string -> unitval map : (char -> char) -> string -> stringval mapi : (int -> char -> char) -> string -> stringval trim : string -> stringval escaped : string -> stringval index : string -> char -> intval index_opt : string -> char -> int optionval rindex : string -> char -> intval rindex_opt : string -> char -> int optionval index_from : string -> int -> char -> intval index_from_opt : string -> int -> char -> int optionval rindex_from : string -> int -> char -> intval rindex_from_opt : string -> int -> char -> int optionval contains : string -> char -> boolval contains_from : string -> int -> char -> boolval rcontains_from : string -> int -> char -> boolval uppercase : string -> stringval lowercase : string -> stringval capitalize : string -> stringval uncapitalize : string -> stringval uppercase_ascii : string -> stringval lowercase_ascii : string -> stringval capitalize_ascii : string -> stringval uncapitalize_ascii : string -> string
include module type of Prime_string
Construction and Conversion
Iteration over Elements
val fold : (char -> 'a -> 'a) -> string -> 'a -> 'afold f sisf s.[n - 1] ∘ ... ∘ f s[0]wheren = length s.
val foldi : (int -> char -> 'a -> 'a) -> string -> 'a -> 'afoldi f sisf (n - 1) s.[n - 1] ∘ ... ∘ f 0 s[0]wheren = length s.
val count : (char -> bool) -> string -> intcount f sis the number of occurrences of a characters inswhich fulfilf.
Search Primitives
val skip_while : (char -> bool) -> string -> int -> intskip_while f sincrements a position until it reaches the end ofsor it points to a character inson whichfreturns false. In other words ifj = skip_while f s i, thenslice i j sis the largest substring starting ation whichfis constant true.
val skip_until : (char -> bool) -> string -> int -> intskip_until fis an optimisation ofskip_while (not ∘ f).
val rskip_while : (char -> bool) -> string -> int -> intrskip_while f sdecrements a position as long as the result points to a character inson whichfis true.
val rskip_until : (char -> bool) -> string -> int -> intrskip_until fis an optimization ofrskip_while (not ∘ f).
Substring Predicates
Slicing
val slice : int -> int -> string -> stringslice i j sis the slice ofsfrom positioniup to but not includingj.
val slice_from : int -> string -> stringslice_from i sis a shortcut forslice i (String.length s) s.
val cut_affix : string -> string -> (string * string) optioncut_affix afx sreturns the substrings before and after the leftmost occurrence ofafxinsorNoneifafxdoes not occur ins.
val rcut_affix : string -> string -> (string * string) optionrcut_affix afx sreturns the substrings before and after the rightmost occurrence ofafxinsorNoneifafxdoes not occur ins.
val chop_affix : string -> string -> string listchop_affix afx sreturns the substrings before, between, and after matches ofafxins, except forchop_affix afx "", which always gives[]. In other wordschop_affix afxprovides a primitive way of extracting the operands of an infix operatorafx. Ifafxcan overlap, it is unspecified which match is used.
val cut_consecutive : (char -> bool) -> string -> (string * string) optioncut_consecutive f sreturns the substrings before and after the leftmost consecutive sequence of bytes satisfyingf, orNoneif notString.exists f s.
val rcut_consecutive : (char -> bool) -> string -> (string * string) optioncut_consecutive f sreturns the substrings before and after the rightmost consecutive sequence of bytes satisfyingf, orNoneif notString.exists f s.
val chop_consecutive : (char -> bool) -> string -> string listchop_consecutive f sreturns the non-empty substrings before, between, and after consecutive sequences of bytescfor whichf cis true. In particularchop_consecutive Char.is_spaceis suitable for splitting words separated by ASCII white-spaces.