diff --git a/website/docs/language/functions/substr.mdx b/website/docs/language/functions/substr.mdx index dab4e3a8f92b..8317848de791 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 ``` + +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 +```