Skip to content

Commit

Permalink
docs: add documentation for starts and endswith
Browse files Browse the repository at this point in the history
  • Loading branch information
FooBartn committed Jul 6, 2022
1 parent fd3798b commit 2278d30
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
10 changes: 10 additions & 0 deletions website/data/language-nav-data.json
Expand Up @@ -319,6 +319,10 @@
"title": "<code>chomp</code>",
"href": "/language/functions/chomp"
},
{
"title": "<code>endswith</code>",
"href": "/language/functions/endswith"
},
{
"title": "<code>format</code>",
"href": "/language/functions/format"
Expand Down Expand Up @@ -352,6 +356,10 @@
"title": "<code>split</code>",
"href": "/language/functions/split"
},
{
"title": "<code>startswith</code>",
"href": "/language/functions/startswith"
},
{
"title": "<code>strrev</code>",
"href": "/language/functions/strrev"
Expand Down Expand Up @@ -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 },
{
Expand Down Expand Up @@ -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 },
Expand Down
30 changes: 30 additions & 0 deletions 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
30 changes: 30 additions & 0 deletions 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
8 changes: 8 additions & 0 deletions website/layouts/language.erb
Expand Up @@ -370,6 +370,10 @@
<a href="/docs/language/functions/chomp.html">chomp</a>
</li>

<li>
<a href="/docs/language/functions/endswith.html">endswith</a>
</li>

<li>
<a href="/docs/language/functions/format.html">format</a>
</li>
Expand Down Expand Up @@ -406,6 +410,10 @@
<a href="/docs/language/functions/split.html">split</a>
</li>

<li>
<a href="/docs/language/functions/startswith.html">startswith</a>
</li>

<li>
<a href="/docs/language/functions/strrev.html">strrev</a>
</li>
Expand Down

0 comments on commit 2278d30

Please sign in to comment.