started writing lexer after making string lib

This commit is contained in:
2026-04-13 19:59:48 +10:00
parent f67c045845
commit c0c35e4d17
24 changed files with 601 additions and 7 deletions

View File

@@ -0,0 +1,27 @@
# string_Substring
Get a substring of a string.
## Arguments
- str (string): the string to get a substring of.
- start (int): starting index of the substring.
- end (int): ending index of the substring.
## Returns
substring (string): the substring of the given string.
## Raises
- `AllocFail`: raised if Ground failed to allocate memory for the new string.
- `EndBeforeStart`: raised if the `end` index is less than the `start` index.
- `OutOfBounds`: raised if either the `end` or `start` index is outside the bounds of the string.
## Example
### Ground
```python
call !string_Substring "Hello, World!" 1 3 &sub
println $sub # "ell"
```
### Solstice
```c
puts string_Substring("Hello, World!", 1, 3) // "ell"
```