public static _sliceAssign(text as String, start as Int, stop as Int, sliceStep as Int, hasStart as Boolean, hasStop as Boolean, replacement as String) as String:
Internal helper used by the compiler to implement string slice assignment.
The helper returns a new string because Klyn strings are represented by an immutable runtime buffer. The compiler stores that returned value back into the assignable target (text[a:b] = replacement).
| 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. |
replacement | Replacement text. |
A new string with the requested slice replaced.
value = String._sliceAssign("Hello World", 6, 11, 1, true, true, "Klyn!")
assert value == "Hello Klyn!"