public native static _slice(text as String, start as Int, stop as Int, sliceStep as Int, hasStart as Boolean, hasStop as Boolean) as String
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].
| 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. |
The sliced string.
assert String._slice("Hello World", 0, 5, 1, true, true) == "Hello"