summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJavier Solana <javiersolanahuertas@gmail.com>2024-07-06 15:32:01 +0200
committerGitHub <noreply@github.com>2024-07-06 09:32:01 -0400
commitbdf3a1eb92020a0d1ce202df14b49f2f13445476 (patch)
tree98cb40a4a366863cab8e710949851bd4c2da1d5b /docs
parent80b7c5a1aba49239b336d7eeed2525acc2d361be (diff)
feat(strings): New functions TrimRight and TrimLeft (#2148)
Signed-off-by: Javier Solana javier.solana@cabify.com Signed-off-by: Javier Solana javier.solana@cabify.com Co-authored-by: Javier Solana <javier.solana@cabify.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/content/functions/strings.md58
1 files changed, 58 insertions, 0 deletions
diff --git a/docs/content/functions/strings.md b/docs/content/functions/strings.md
index fe37830f..9ec1589a 100644
--- a/docs/content/functions/strings.md
+++ b/docs/content/functions/strings.md
@@ -669,6 +669,35 @@ $ gomplate -i '{{ "_-foo-_" | strings.Trim "_-" }}'
foo
```
+## `strings.TrimLeft`_(unreleased)_
+**Unreleased:** _This function is in development, and not yet available in released builds of gomplate._
+
+Trims a string by removing the given characters from the beginning of the string.
+This wraps Go's [`strings.TrimLeft`](https://pkg.go.dev/strings#TrimLeft).
+
+### Usage
+
+```
+strings.TrimLeft cutset input
+```
+```
+input | strings.TrimLeft cutset
+```
+
+### Arguments
+
+| name | description |
+|------|-------------|
+| `cutset` | _(required)_ the set of characters to cut |
+| `input` | _(required)_ the input |
+
+### Examples
+
+```console
+$ gomplate -i '{{ " - hello, world!" | strings.TrimLeft " " }}'
+- hello, world!
+```
+
## `strings.TrimPrefix`
Returns a string without the provided leading prefix string, if the prefix is present.
@@ -699,6 +728,35 @@ $ gomplate -i '{{ "hello, world" | strings.TrimPrefix "hello, " }}'
world
```
+## `strings.TrimRight`_(unreleased)_
+**Unreleased:** _This function is in development, and not yet available in released builds of gomplate._
+
+Trims a string by removing the given characters from the end of the string.
+This wraps Go's [`strings.TrimRight`](https://pkg.go.dev/strings#TrimRight).
+
+### Usage
+
+```
+strings.TrimRight cutset input
+```
+```
+input | strings.TrimRight cutset
+```
+
+### Arguments
+
+| name | description |
+|------|-------------|
+| `cutset` | _(required)_ the set of characters to cut |
+| `input` | _(required)_ the input |
+
+### Examples
+
+```console
+$ gomplate -i '{{ "hello, world! " | strings.TrimRight " " }}'
+hello, world!
+```
+
## `strings.TrimSpace`
**Alias:** `trimSpace`