public static _sliceAssign(text as String, start as Long, stop as Long, sliceStep as Long, hasStart as Boolean, hasStop as Boolean, replacement as String) as String
Internal helper used by the compiler to implement string slice assignment.
Slice assignment can change the number of characters. This helper returns a new immutable backing value which the compiler stores in the existing MutableString object. Aliases observe the edit; earlier String snapshots remain unchanged. The backing value is published only after success.
| 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 = m"Hello World" value[6:11] = "Klyn!" assert value == "Hello Klyn!"