package tezos-stdlib

  1. Overview
  2. Docs
val split : char -> ?limit:int -> string -> string list

split delim ~limit str splits str into a list of strings. Splitting occurs on delim characters (which are removed from output) at most limit times. Remaining delim characters are included in the last element of the resulting list.

limit defaults to max_int.

This function obeys the invariant that for all limits, delims and strs: String.concat (String.init 1 (fun _ -> delim)) (split delim ~limit str) = str.

val split_no_empty : char -> ?limit:int -> string -> string list

Splits a string on a delimiter character. It strips delimiters at the beginning and at the end. It considers groups of delimiters as one. If limit is passed, stops after limit split(s). limit defaults to max_int. It's guaranteed to never produce empty strings in the output. Therefore, it's capable of producing an empty list as a result.

For example, split_no_empty ',' ",hello,,world," returns "hello"; "world"

val has_prefix : prefix:string -> string -> bool

true if input has prefix

val remove_prefix : prefix:string -> string -> string option

Some (input with prefix removed), if string has prefix, else None

val common_prefix : string -> string -> int

Length of common prefix of input strings

val mem_char : string -> char -> bool

Test whether a string contains a given character

val fold_left : ('a -> char -> 'a) -> 'a -> string -> 'a

Functional iteration over the characters of a string from first to last

val pp_bytes_hex : Format.formatter -> bytes -> unit

Pretty print bytes as hexadecimal string.