mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 08:51:02 -06:00
lang/funcs: add 'strrev' interpolation function. (#21091)
This commit is contained in:
parent
9327eedb04
commit
efc08de5d6
@ -99,6 +99,7 @@ func (s *Scope) Functions() map[string]function.Function {
|
||||
"slice": funcs.SliceFunc,
|
||||
"sort": funcs.SortFunc,
|
||||
"split": funcs.SplitFunc,
|
||||
"strrev": stdlib.ReverseFunc,
|
||||
"substr": stdlib.SubstrFunc,
|
||||
"timestamp": funcs.TimestampFunc,
|
||||
"timeadd": funcs.TimeAddFunc,
|
||||
|
@ -25,3 +25,7 @@ with all of the same elements as the given sequence but in reverse order.
|
||||
1,
|
||||
]
|
||||
```
|
||||
|
||||
## Related Functions
|
||||
|
||||
* [`strrev`](./strrev.html) reverses a string.
|
||||
|
29
website/docs/configuration/functions/strrev.html.md
Normal file
29
website/docs/configuration/functions/strrev.html.md
Normal file
@ -0,0 +1,29 @@
|
||||
---
|
||||
layout: "functions"
|
||||
page_title: "strrev - Functions - Configuration Language"
|
||||
sidebar_current: "docs-funcs-string-strrev"
|
||||
description: |-
|
||||
The strrev function reverses a string.
|
||||
---
|
||||
|
||||
# `strrev` Function
|
||||
|
||||
`strrev` reverses the characters in a string.
|
||||
Note that the characters are treated as _Unicode characters_ (in technical terms, Unicode [grapheme cluster boundaries](https://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries) are respected).
|
||||
|
||||
```hcl
|
||||
strrev(string)
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
> strrev("hello")
|
||||
olleh
|
||||
> strrev("a ☃")
|
||||
☃ a
|
||||
```
|
||||
|
||||
## Related Functions
|
||||
|
||||
* [`reverse`](./reverse.html) reverses a sequence.
|
@ -87,6 +87,10 @@
|
||||
<a href="/docs/configuration/functions/split.html">split</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="/docs/configuration/functions/strrev.html">strrev</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="/docs/configuration/functions/substr.html">substr</a>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user