← SPL reference

String slicing (string.slice)

SPL substring rules are intentionally not Python’s s[a:b]. Bounds use a mixed convention so short examples read naturally.

string.slice(lo, hi, string)

Shorthand: [var] <- sl(lo, hi);

Parses as “read the current string in var, slice with the same string.slice rules, assign back”. Requires var to already hold a string.

txt.setVar("hello");

[txt] <- sl(2, string.sliceMax());

print.string(txt);   # llo

Implementation: someProgrammingLanguage/main.py (_spl_string_slice), searchable as string.slice / string.sliceMin / string.sliceMax in the reference table.