diff --git a/website/data/language-nav-data.json b/website/data/language-nav-data.json index a0ec64131e..60a649ada4 100644 --- a/website/data/language-nav-data.json +++ b/website/data/language-nav-data.json @@ -319,6 +319,10 @@ "title": "chomp", "href": "/language/functions/chomp" }, + { + "title": "endswith", + "href": "/language/functions/endswith" + }, { "title": "format", "href": "/language/functions/format" @@ -352,6 +356,10 @@ "title": "split", "href": "/language/functions/split" }, + { + "title": "startswith", + "href": "/language/functions/startswith" + }, { "title": "strrev", "href": "/language/functions/strrev" @@ -776,6 +784,7 @@ { "title": "dirname", "path": "functions/dirname", "hidden": true }, { "title": "distinct", "path": "functions/distinct", "hidden": true }, { "title": "element", "path": "functions/element", "hidden": true }, + { "title": "endswith", "path": "functions/endswith", "hidden": true }, { "title": "file", "path": "functions/file", "hidden": true }, { "title": "filebase64", "path": "functions/filebase64", "hidden": true }, { @@ -851,6 +860,7 @@ { "title": "slice", "path": "functions/slice", "hidden": true }, { "title": "sort", "path": "functions/sort", "hidden": true }, { "title": "split", "path": "functions/split", "hidden": true }, + { "title": "startswith", "path": "functions/startswith", "hidden": true }, { "title": "strrev", "path": "functions/strrev", "hidden": true }, { "title": "substr", "path": "functions/substr", "hidden": true }, { "title": "sum", "path": "functions/sum", "hidden": true }, diff --git a/website/docs/language/functions/endswith.mdx b/website/docs/language/functions/endswith.mdx new file mode 100644 index 0000000000..8599f3582b --- /dev/null +++ b/website/docs/language/functions/endswith.mdx @@ -0,0 +1,30 @@ +--- +page_title: endswith - Functions - Configuration Language +description: |- + The endswith function takes a given string and a given suffix value, + and returns true if the first given string contains the given value at its end. +--- + +# `endswith` Function + +`endswith` takes a given string and a given suffix value, +and returns true if the first given string contains the given value at its end. + +```hcl +endswith(string, suffix) +``` + +## Examples + +``` +> endswith("hello world", "world") +true + +> endswith("hello world", "hello") +false +``` + +## Related Functions + +- [`startswith`](/language/functions/startswith) takes a given string and a given prefix value, + and returns true if the first given string contains the given value at its beginning diff --git a/website/docs/language/functions/startswith.mdx b/website/docs/language/functions/startswith.mdx new file mode 100644 index 0000000000..02295beade --- /dev/null +++ b/website/docs/language/functions/startswith.mdx @@ -0,0 +1,30 @@ +--- +page_title: startsswith - Functions - Configuration Language +description: |- + The startswith function takes a given string and a given prefix value, + and returns true if the first given string contains the given value at its beginning. +--- + +# `startswith` Function + +`startswith` takes a given string and a given prefix value, +and returns true if the first given string contains the given value at its beginning. + +```hcl +startswith(string, prefix) +``` + +## Examples + +``` +> startswith("hello world", "hello") +true + +> startswith("hello world", "world") +false +``` + +## Related Functions + +- [`endswith`](/language/functions/endswith) takes a given string and a given suffix value, + and returns true if the first given string contains the given value at its end \ No newline at end of file diff --git a/website/layouts/language.erb b/website/layouts/language.erb index 7f7e55e7f3..f2bf83dede 100644 --- a/website/layouts/language.erb +++ b/website/layouts/language.erb @@ -370,6 +370,10 @@ chomp +
  • + endswith +
  • +
  • format
  • @@ -406,6 +410,10 @@ split +
  • + startswith +
  • +
  • strrev