package octez-libs

  1. Overview
  2. Docs
A package that contains multiple base libraries used by the Octez suite

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-18.1.tar.gz
sha256=aa2f5bc99cc4ca2217c52a1af2a2cdfd3b383208cb859ca2e79ca0903396ca1d
sha512=d68bb3eb615e3dcccc845fddfc9901c95b3c6dc8e105e39522ce97637b1308a7fa7aa1d271351d5933febd7476b2819e1694f31198f1f0919681f1f9cc97cb3a

doc/octez-libs.stdlib/Tezos_stdlib/TzString/index.html

Module Tezos_stdlib.TzStringSource

Sourceval 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.

Sourceval 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"

Sourceval chunk_bytes : ?error_on_partial_chunk:'a -> int -> bytes -> (string list, 'a) result

chunk_bytes n b chunks the sequence of bytes b into a list of strings, each of length n. The last chunk may be a non-empty string of length less than n, in which case the behaviour of the function depends on whether error_on_partial_chunk is set:

  • If error_on_partial_chunk is set, then the function returns Error error_on_partial_chunk,
  • Otherwise, the function return the list of chunks, where the last chunk is a non-empty string of length less than n.
Sourceval has_prefix : prefix:string -> string -> bool

true if input has prefix

Sourceval remove_prefix : prefix:string -> string -> string option

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

Sourceval remove_suffix : suffix:string -> string -> string option

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

Sourceval common_prefix : string -> string -> int

Length of common prefix of input strings

Sourceval mem_char : string -> char -> bool

Test whether a string contains a given character

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

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

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

Pretty print bytes as hexadecimal string.

OCaml

Innovation. Community. Security.