Skip to content

Commit 322bed7

Browse files
committed
string.span
1 parent c4a564d commit 322bed7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/Runtime Environment/String.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,16 @@ A new string.
301301
print("58595a":fromhex()) --> XYZ
302302
print("58 59 5A":fromhex()) --> XYZ
303303
```
304+
---
305+
### `string.span`
306+
Returns a substring from a starting position and length. This differs from string.sub, which takes a start and end position.
307+
#### Parameters
308+
1. The string.
309+
2. The starting position.
310+
3. The length.
311+
#### Returns
312+
The substring.
313+
```pluto
314+
print("abcd":sub(2, 2)) --> b
315+
print("abcd":span(2, 2)) --> bc
316+
```

0 commit comments

Comments
 (0)