Module Core_kernel.String
This module extends Base.String.
include module type of sig ... end
val t_sexp_grammar : Base.Sexp.Private.Raw_grammar.tval sub : (t, t) Base.Blit.subval subo : (t, t) Base.Blit.subo
val mem : t -> elt -> boolval is_empty : t -> boolval iter : t -> f:(elt -> unit) -> unitval fold : t -> init:'accum -> f:('accum -> elt -> 'accum) -> 'accumval fold_result : t -> init:'accum -> f:('accum -> elt -> ('accum, 'e) Base.Result.t) -> ('accum, 'e) Base.Result.tval fold_until : t -> init:'accum -> f:('accum -> elt -> ('accum, 'final) Base__.Container_intf.Continue_or_stop.t) -> finish:('accum -> 'final) -> 'finalval exists : t -> f:(elt -> bool) -> boolval for_all : t -> f:(elt -> bool) -> boolval count : t -> f:(elt -> bool) -> intval sum : (module Base__.Container_intf.Summable with type t = 'sum) -> t -> f:(elt -> 'sum) -> 'sumval find : t -> f:(elt -> bool) -> elt optionval find_map : t -> f:(elt -> 'a option) -> 'a optionval to_list : t -> elt listval to_array : t -> elt arrayval min_elt : t -> compare:(elt -> elt -> int) -> elt optionval max_elt : t -> compare:(elt -> elt -> int) -> elt optionval hash_fold_t : Base.Hash.state -> t -> Base.Hash.stateval t_of_sexp : Sexplib0.Sexp.t -> tval sexp_of_t : t -> Sexplib0.Sexp.tval of_string : string -> tval to_string : t -> stringval (>=) : t -> t -> boolval (<=) : t -> t -> boolval (=) : t -> t -> boolval (>) : t -> t -> boolval (<) : t -> t -> boolval (<>) : t -> t -> boolval compare : t -> t -> intval min : t -> t -> tval max : t -> t -> tval ascending : t -> t -> intval descending : t -> t -> intval between : t -> low:t -> high:t -> boolval clamp_exn : t -> min:t -> max:t -> tval clamp : t -> min:t -> max:t -> t Base.Or_error.t
type comparator_witness= Base__String.comparator_witness
val comparator : (t, comparator_witness) Base.Comparator.comparatorval validate_lbound : min:t Base.Maybe_bound.t -> t Base.Validate.checkval validate_ubound : max:t Base.Maybe_bound.t -> t Base.Validate.checkval validate_bound : min:t Base.Maybe_bound.t -> max:t Base.Maybe_bound.t -> t Base.Validate.checkval pp : Base.Formatter.t -> t -> unitval invariant : t Base__.Invariant_intf.invval max_length : int
val make : int -> char -> tval copy : t -> tval init : int -> f:(int -> char) -> tval (^) : t -> t -> tval concat : ?sep:t -> t list -> tval escaped : t -> tval contains : ?pos:int -> ?len:int -> t -> char -> boolval uppercase : t -> tval lowercase : t -> tval capitalize : t -> tval uncapitalize : t -> t
module Caseless = Base__String.Caselessval index : t -> char -> int optionval index_exn : t -> char -> intval index_from : t -> int -> char -> int optionval index_from_exn : t -> int -> char -> intval rindex : t -> char -> int optionval rindex_exn : t -> char -> intval rindex_from : t -> int -> char -> int optionval rindex_from_exn : t -> int -> char -> int
val substr_index : ?pos:int -> t -> pattern:t -> int optionval substr_index_exn : ?pos:int -> t -> pattern:t -> intval substr_index_all : t -> may_overlap:bool -> pattern:t -> int listval substr_replace_first : ?pos:int -> t -> pattern:t -> with_:t -> tval substr_replace_all : t -> pattern:t -> with_:t -> tval is_substring : t -> substring:t -> boolval is_substring_at : t -> pos:int -> substring:t -> boolval to_list_rev : t -> char listval rev : t -> tval is_suffix : t -> suffix:t -> boolval is_prefix : t -> prefix:t -> boolval lsplit2_exn : t -> on:char -> t * tval rsplit2_exn : t -> on:char -> t * tval lsplit2 : t -> on:char -> (t * t) optionval rsplit2 : t -> on:char -> (t * t) optionval split : t -> on:char -> t listval split_on_chars : t -> on:char list -> t listval split_lines : t -> t listval lfindi : ?pos:int -> t -> f:(int -> char -> bool) -> int optionval rfindi : ?pos:int -> t -> f:(int -> char -> bool) -> int optionval lstrip : ?drop:(char -> bool) -> t -> tval rstrip : ?drop:(char -> bool) -> t -> tval strip : ?drop:(char -> bool) -> t -> tval map : t -> f:(char -> char) -> tval mapi : t -> f:(int -> char -> char) -> tval foldi : t -> init:'a -> f:(int -> 'a -> char -> 'a) -> 'aval concat_map : ?sep:t -> t -> f:(char -> t) -> tval filter : t -> f:(char -> bool) -> tval tr : target:char -> replacement:char -> t -> tval tr_multi : target:t -> replacement:t -> (t -> t) Base.Staged.tval chop_suffix_exn : t -> suffix:t -> tval chop_prefix_exn : t -> prefix:t -> tval chop_suffix : t -> suffix:t -> t optionval chop_prefix : t -> prefix:t -> t optionval chop_suffix_if_exists : t -> suffix:t -> tval chop_prefix_if_exists : t -> prefix:t -> tval suffix : t -> int -> tval prefix : t -> int -> tval drop_suffix : t -> int -> tval drop_prefix : t -> int -> tval concat_array : ?sep:t -> t array -> t
val hash : t -> int
module Escaping = Base__String.Escapinginclude Bin_prot.Binable.S with type t := t
include Bin_prot.Binable.S_only_functions with type t := t
val bin_size_t : t Bin_prot.Size.sizerval bin_write_t : t Bin_prot.Write.writerval bin_read_t : t Bin_prot.Read.readerval __bin_read_t__ : (int -> t) Bin_prot.Read.readerThis function only needs implementation if
texposed to be a polymorphic variant. Despite what the type reads, this does *not* produce a function after reading; instead it takes the constructor tag (int) before reading and reads the rest of the varianttafterwards.
val bin_shape_t : Bin_prot.Shape.tval bin_writer_t : t Bin_prot.Type_class.writerval bin_reader_t : t Bin_prot.Type_class.readerval bin_t : t Bin_prot.Type_class.t
include Typerep_lib.Typerepable.S with type t := t
val typerep_of_t : t Typerep_lib.Std_internal.Typerep.tval typename_of_t : t Typerep_lib.Typename.t
module Caseless : sig ... endCaselesscompares and hashes strings ignoring case, so that for exampleCaseless.equal "OCaml" "ocaml"andCaseless.("apple" < "Banana")aretrue, andCaseless.Map,Caseless.Tablelookup andCaseless.Setmembership is case-insensitive.
val slice : t -> int -> int -> tslice t start stopreturns a new string including elementst.(start)throught.(stop-1), normalized Python-style with the exception thatstop = 0is treated asstop = length t.
val nget : t -> int -> charnget s igets the char at normalized positioniins.
val take_while : t -> f:(char -> bool) -> ttake_while s ~freturns the longest prefix ofssatisfyingfor_all prefix ~f(Seelstripto drop such a prefix)
val rtake_while : t -> f:(char -> bool) -> trtake_while s ~freturns the longest suffix ofssatisfyingfor_all suffix ~f(Seerstripto drop such a suffix)
include Identifiable.S with type t := t and type comparator_witness := comparator_witness
include Bin_prot.Binable.S with type t := t
include Bin_prot.Binable.S_only_functions with type t := t
val bin_size_t : t Bin_prot.Size.sizerval bin_write_t : t Bin_prot.Write.writerval bin_read_t : t Bin_prot.Read.readerval __bin_read_t__ : (int -> t) Bin_prot.Read.readerThis function only needs implementation if
texposed to be a polymorphic variant. Despite what the type reads, this does *not* produce a function after reading; instead it takes the constructor tag (int) before reading and reads the rest of the varianttafterwards.
val bin_shape_t : Bin_prot.Shape.tval bin_writer_t : t Bin_prot.Type_class.writerval bin_reader_t : t Bin_prot.Type_class.readerval bin_t : t Bin_prot.Type_class.t
val hash_fold_t : Base.Hash.state -> t -> Base.Hash.stateval hash : t -> Base.Hash.hash_value
include Ppx_sexp_conv_lib.Sexpable.S with type t := t
val t_of_sexp : Sexplib0.Sexp.t -> tval sexp_of_t : t -> Sexplib0.Sexp.t
include Identifiable.S_common with type t := t
val compare : t -> t -> Core_kernel__.Import.intval hash_fold_t : Base.Hash.state -> t -> Base.Hash.stateval hash : t -> Base.Hash.hash_valueval sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
include Core_kernel__.Import.Stringable.S with type t := t
include Core_kernel__.Import.Pretty_printer.S with type t := t
val pp : Base.Formatter.t -> t -> unit
include Comparable.S_binable with type t := t
include Core_kernel__.Comparable_intf.S_common
include Base.Comparable.S
include Base__.Comparable_intf.Polymorphic_compare
val ascending : t -> t -> intascendingis identical tocompare.descending x y = ascending y x. These are intended to be mnemonic when used likeList.sort ~compare:ascendingandList.sort ~cmp:descending, since they cause the list to be sorted in ascending or descending order, respectively.
val descending : t -> t -> intval between : t -> low:t -> high:t -> boolbetween t ~low ~highmeanslow <= t <= high
val clamp_exn : t -> min:t -> max:t -> tclamp_exn t ~min ~maxreturnst', the closest value totsuch thatbetween t' ~low:min ~high:maxis true.Raises if
not (min <= max).
val clamp : t -> min:t -> max:t -> t Base.Or_error.t
include Base.Comparator.S with type t := t
val comparator : (t, comparator_witness) Base.Comparator.comparator
include Base__.Comparable_intf.Validate with type t := t
val validate_lbound : min:t Base.Maybe_bound.t -> t Base.Validate.checkval validate_ubound : max:t Base.Maybe_bound.t -> t Base.Validate.checkval validate_bound : min:t Base.Maybe_bound.t -> max:t Base.Maybe_bound.t -> t Base.Validate.check
module Replace_polymorphic_compare : Core_kernel__.Comparable_intf.Polymorphic_compare with type t := tinclude Core_kernel__.Comparable_intf.Map_and_set_binable with type t := t with type comparator_witness := comparator_witness
include Comparator.S with type t := t
val comparator : (t, comparator_witness) Comparator.comparator
module Map : Map.S_binable with type Key.t = t with type Key.comparator_witness = comparator_witnessmodule Set : Set.S_binable with type Elt.t = t with type Elt.comparator_witness = comparator_witnessinclude Hashable.S_binable with type t := t
val hash_fold_t : Base.Hash.state -> t -> Base.Hash.stateval hash : t -> Base.Hash.hash_value
val hashable : t Hashtbl.Hashable.t
module Table : Hashtbl.S_binable with type key = tmodule Hash_set : Hash_set.S_binable with type elt = tmodule Hash_queue : Hash_queue.S with type key = tinclude Quickcheckable.S with type t := t
val quickcheck_generator : t Base_quickcheck.Generator.tval quickcheck_observer : t Base_quickcheck.Observer.tval quickcheck_shrinker : t Base_quickcheck.Shrinker.t
val gen_nonempty : t Quickcheck.Generator.tLike
gen, but without empty strings.
val gen' : char Quickcheck.Generator.t -> t Quickcheck.Generator.tLike
gen, but generate strings with the given distribution of characters.
val gen_nonempty' : char Quickcheck.Generator.t -> t Quickcheck.Generator.tLike
gen', but without empty strings.
val gen_with_length : int -> char Quickcheck.Generator.t -> t Quickcheck.Generator.tLike
gen', but generate strings with the given length.
module Stable : sig ... endNote that
stringis already stable by itself, since as a primitive type it is an integral part of the sexp / bin_io protocol.String.Stableexists only to introduceString.Stable.Set,String.Stable.Map,String.Stable.Table, and provide interface uniformity with other stable types.