🐐 String indexing and slicing
This commit is contained in:
15
README.md
15
README.md
@@ -70,6 +70,21 @@ Any expression can appear inside `{}`. Values are coerced to strings the same wa
|
||||
|
||||
Single-quoted strings do **not** interpolate — `'{nomen}'` is the literal text `{nomen}`. Use `{{` and `}}` for literal braces in double-quoted strings: `"use {{braces}}"` → `use {braces}`.
|
||||
|
||||
#### String Indexing and Slicing
|
||||
|
||||
Strings support the same indexing and slicing syntax as arrays. Indexing is 1-based and returns a single-character string:
|
||||
|
||||
```
|
||||
"SALVTE"[I] @> "S"
|
||||
"SALVTE"[III] @> "L"
|
||||
```
|
||||
|
||||
Slicing uses `VSQVE` with inclusive bounds, returning a substring:
|
||||
|
||||
```
|
||||
"SALVTE"[II VSQVE IV] @> "ALV"
|
||||
```
|
||||
|
||||
Integer modulo is `RELIQVVM`: `VII RELIQVVM III` evaluates to `I`. Under the `FRACTIO` module it returns a fraction, so `IIIS RELIQVVM IS` is `S` (i.e. 1/2).
|
||||
|
||||
### Integers
|
||||
|
||||
Reference in New Issue
Block a user