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 Jun 30, 2022
1 parent fd3798b commit f74e93a
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
8 changes: 8 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
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 f74e93a

Please sign in to comment.