Merge pull request #28745 from hashicorp/jbardin/substr

negative substring indexes
This commit is contained in:
James Bardin 2021-05-19 11:12:38 -04:00 committed by GitHub
commit d27a6d3d1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -29,3 +29,12 @@ bytes:
> substr("🤔🤷", 0, 1)
🤔
```
The offset index may be negative, in which case it is relative to the end of
the given string. The length may be -1, in which case the remainder of the
string after the given offset will be returned.
```
> substr("hello world", -5, -1)
world
```