package dune-configurator

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t = string
include module type of struct include StringLabels end with type t := t
val length : string -> int
val get : string -> int -> char
val set : bytes -> int -> char -> unit
  • deprecated Use BytesLabels.set instead.
val create : int -> bytes
  • deprecated Use BytesLabels.create instead.
val make : int -> char -> string
val init : int -> f:(int -> char) -> string
val copy : string -> string
val sub : string -> pos:int -> len:int -> string
val fill : bytes -> pos:int -> len:int -> char -> unit
  • deprecated Use BytesLabels.fill instead.
val blit : src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit
val concat : sep:string -> string list -> string
val iter : f:(char -> unit) -> string -> unit
val iteri : f:(int -> char -> unit) -> string -> unit
val map : f:(char -> char) -> string -> string
val mapi : f:(int -> char -> char) -> string -> string
val trim : string -> string
val escaped : string -> string
val index_opt : string -> char -> int option
val rindex_opt : string -> char -> int option
val index_from_opt : string -> int -> char -> int option
val rindex_from_opt : string -> int -> char -> int option
val contains : string -> char -> bool
val contains_from : string -> int -> char -> bool
val rcontains_from : string -> int -> char -> bool
val uppercase_ascii : string -> string
val lowercase_ascii : string -> string
val capitalize_ascii : string -> string
val uncapitalize_ascii : string -> string
val split_on_char : sep:char -> string -> string list
val unsafe_get : string -> int -> char
val unsafe_set : bytes -> int -> char -> unit
  • deprecated
val unsafe_blit : src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit
val unsafe_fill : bytes -> pos:int -> len:int -> char -> unit
  • deprecated
val equal : t -> t -> bool
val compare : t -> t -> Ordering.t
val hash : t -> int
val to_dyn : t -> Dyn.t
val break : t -> pos:int -> t * t
val is_empty : t -> bool
val is_prefix : t -> prefix:t -> bool
val is_suffix : t -> suffix:t -> bool
val take : t -> int -> t
val drop : t -> int -> t
val split_n : t -> int -> t * t
val drop_prefix : t -> prefix:t -> t option
val drop_suffix : t -> suffix:t -> t option
val capitalize : t -> t

These only change ASCII characters

val uncapitalize : t -> t
val uppercase : t -> t
val lowercase : t -> t
val index : t -> char -> int option
val index_from : t -> int -> char -> int option
val rindex : t -> char -> int option
val rindex_from : t -> int -> char -> int option
val extract_words : t -> is_word_char:(char -> bool) -> t list
val extract_comma_space_separated_words : t -> t list
val extract_blank_separated_words : t -> t list
val lsplit2 : t -> on:char -> (t * t) option
val lsplit2_exn : t -> on:char -> t * t
val rsplit2 : t -> on:char -> (t * t) option
val split : t -> on:char -> t list
val split_lines : t -> t list
val escape_only : char -> t -> t

Escace ONLY one character. escape also escapes '\n',... and transforms all chars above '~' into '\xxx' which is not suitable for UTF-8 strings.

val longest : string list -> int

Return the length of the longest string in the list

val longest_map : 'a list -> f:('a -> string) -> int
val longest_prefix : t list -> t
val exists : t -> f:(char -> bool) -> bool
val for_all : t -> f:(char -> bool) -> bool
val maybe_quoted : t -> t

maybe_quoted s is s if s doesn't need escaping according to OCaml lexing conventions and sprintf "%S" s otherwise.

(* CR-someday aalekseyev: this function is not great: barely anything "needs escaping according to OCaml lexing conventions", so the condition for whether to add the quote characters ends up being quite arbitrary. *)

val enumerate_and : string list -> string

Produces: "x, y and z"

val enumerate_or : string list -> string

Produces: "x, y or z"

val enumerate_one_of : t list -> t

Produces: "One of x, y or z"

val findi : string -> f:(char -> bool) -> int option

Find index of first character satisfying f

module Set : sig ... end
module Map : sig ... end
module Table : Hashtbl.S with type key = t
val need_quoting : string -> bool

Whether the string needs quoting if it is part of a shell command

val quote_for_shell : string -> string

quote_for_shell s quotes s using Filename.quote if need_quoting s is true

OCaml

Innovation. Community. Security.