Update string doc: index can be negative (#1198)
This commit is contained in:
parent
f9ab828e29
commit
8d4f9304c0
@ -219,7 +219,8 @@ Typst provides utility methods for string manipulation. Many of these methods
|
||||
either a string or a [regular expression]($func/regex). This makes the methods
|
||||
quite versatile.
|
||||
|
||||
All lengths and indices are expressed in terms of UTF-8 bytes.
|
||||
All lengths and indices are expressed in terms of UTF-8 characters. Indices are
|
||||
zero-based and negative indices wrap around to the end of the string.
|
||||
|
||||
### Example
|
||||
```example
|
||||
|
@ -24,6 +24,8 @@
|
||||
// Test the `at` method.
|
||||
#test("Hello".at(1), "e")
|
||||
#test("Hello".at(4), "o")
|
||||
#test("Hello".at(-1), "o")
|
||||
#test("Hello".at(-2), "l")
|
||||
#test("Hey: 🏳️🌈 there!".at(5), "🏳️🌈")
|
||||
|
||||
---
|
||||
|
Loading…
x
Reference in New Issue
Block a user