Module CCString.Sub

type t = string * int * int

A string, an offset, and the length of the slice.

val make : string ‑> int ‑> len:int ‑> t
val full : string ‑> t

Full string.

val copy : t ‑> string

Make a copy of the substring.

val underlying : t ‑> string
val sub : t ‑> int ‑> int ‑> t

Sub-slice.

val get : t ‑> int ‑> char

get s i gets the i-th element, or fails.

include S with type t := t
type t
val length : t ‑> int

Return the length (number of characters) of the given string.

val blit : t ‑> int ‑> Bytes.t ‑> int ‑> int ‑> unit

Similar to String.blit. Compatible with the -safe-string option.

  • Raises Invalid_argument: if indices are not valid.
val fold : ('a ‑> char ‑> 'a) ‑> 'a ‑> t ‑> 'a

Fold on chars by increasing index.

  • Since: 0.7

Conversions

val to_gen : t ‑> char gen

Return the gen of characters contained in the string

val to_seq : t ‑> char sequence

Return the sequence of characters contained in the string

val to_klist : t ‑> char klist

Return the klist of characters contained in the string

val to_list : t ‑> char list

Return the list of characters contained in the string.

val pp_buf : Buffer.t ‑> t ‑> unit

Renamed from pp.

  • Since: 2.0
val pp : Format.formatter ‑> t ‑> unit

Print the string within quotes. Renamed from print.

  • Since: 2.0