klyn.String._slice
method

    public static _slice(text as String, start as Int, stop as Int, sliceStep as Int, hasStart as Boolean, hasStop as Boolean) as String:

Description

Internal helper used by the compiler to implement slice syntax.

The `hasStart` and `hasStop` flags preserve omitted bounds from source expressions such as `text[:5]`, `text[3:]` or `text[::-1]`.

Parameters

Parameter | Description
--- | ---
`text` | Source string.
`start` | Requested start bound.
`stop` | Requested exclusive stop bound.
`sliceStep` | Slice step. Cannot be zero.
`hasStart` | True when the source slice explicitly provided a start.
`hasStop` | True when the source slice explicitly provided a stop.

Returns

The sliced string.

Example

    assert String._slice("Hello World", 0, 5, 1, true, true) == "Hello"