Version: Next
String
let length: (s: 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.
let size_op = (s: string): nat => String.length(s);
let sub: (offset: nat, length: nat, s: 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".
let slice_op = (s: string): string => String.sub(1 as nat, 2 as nat, s);
let concat: (a: string, b: string) => string
Concatenate two strings and return the result.
let concat_syntax = (s: string): string => String.concat(s, "test_literal");
Alternatively:
let concat_syntax_alt = (s: string): string => s + "test_literal";