Version: 0.17.0


function length : string -> nat

Get the size of a string.

Michelson only supports ASCII strings so for now you can assume that each character takes one byte of storage.

function string_size (const s: string) : nat is String.length(s)

Note that size and String.size are deprecated.

function sub : nat -> nat -> string -> string

Extract a substring from a string based on the given offset and length. For example the string "abcd" given to the function below would return "bc".

function slice_op (const s : string) : string is String.sub(1n , 2n , s)

Note that string_slice is deprecated.

function concat : string -> string -> string

Concatenate two strings and return the result.

function concat_op (const s : string) : string is String.concat(s, "toto")


function concat_op_alt (const s : string) : string is s ^ "toto"