Up

Module Bigsubstring

Substring type based on Bigarray, for use in I/O and C-bindings

Signature

include Make_substring.S with type base = Bigstring.t
type base = Bigstring.t

the type of strings that type t is a substring of

type t
val base : t -> base

The pos refers to the position in the base string, not any other substring that this substring was generated from.

val pos : t -> int
val length : t -> int
val create : ?pos:int -> ?len:int -> base -> t

create ?pos ?len base creates a substring of the base sequence of length len starting at position pos, i.e.

 base.[pos], base.[pos + 1], ... base.[pos + len - 1] 

It is required that:

  • 0 <= pos
  • 0 <= len
  • pos + len <= length base

It does not copy the characters.

Blit functions

for copying characters from a substring to and from both strings and substrings.

val blit_to_string : t -> dst:string -> dst_pos:int -> unit
val blit_to_bigstring : t -> dst:Bigstring.t -> dst_pos:int -> unit
val blit_from_string : t -> src:string -> src_pos:int -> len:int -> unit
val blit_from_bigstring : t -> src:Bigstring.t -> src_pos:int -> len:int -> unit
String concatenation
val concat : t list -> t
val concat_string : t list -> string
val concat_bigstring : t list -> Bigstring.t
val of_bigstring : Bigstring.t -> t
Conversion to substrings

. These may share memory with the thing from which they are copying.

val of_string : string -> t
val to_bigstring : t -> Bigstring.t

these two functions perform a copy

val to_string : t -> string
Prefixes and suffixes

The result of these functions may share data with their input.

val drop_prefix : t -> int -> t
val drop_suffix : t -> int -> t
val prefix : t -> int -> t
val suffix : t -> int -> t