Skip to main content
Version: 1.3.0

Slicing

Substrings can be extracted using the predefined function String.sub. The first character has index 0 and the interval of indices for the substring has inclusive bounds.

The offset and length of the slice are natural number:

const name = "Alice";
const slice = String.sub (0n, 1n, name); // slice == "A"

Note: See predefined namespace String