Merge pull request #30483 from bpar476/patch-1

Adds documentation to `substr` function to cover when `length` exceeds input length
This commit is contained in:
Laura Pacilio 2022-02-15 11:27:47 -05:00 committed by GitHub
commit 68e70d71d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -7,7 +7,7 @@ description: |-
# `substr` Function
`substr` extracts a substring from a given string by offset and length.
`substr` extracts a substring from a given string by offset and (maximum) length.
```hcl
substr(string, offset, length)
@ -36,3 +36,11 @@ string after the given offset will be returned.
> substr("hello world", -5, -1)
world
```
If the length is greater than the length of the string, the substring
will be the length of all remaining characters.
```
> substr("hello world", 6, 10)
world
```