diff --git a/website/docs/language/functions/substr.mdx b/website/docs/language/functions/substr.mdx index dab4e3a8f..1ccd24cc1 100644 --- a/website/docs/language/functions/substr.mdx +++ b/website/docs/language/functions/substr.mdx @@ -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 ``` + +The length may be greater than the length of the string, in which case the substring +will be the length of all remaining characters. + +``` +> substr("hello world", 6, 10) +world +```