klyn.String._slice
method
public native 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
ParameterDescription
textSource string.
startRequested start bound.
stopRequested exclusive stop bound.
sliceStepSlice step. Cannot be zero.
hasStartTrue when the source slice explicitly provided a start.
hasStopTrue when the source slice explicitly provided a stop.
Returns

The sliced string.

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