summaryrefslogtreecommitdiff
path: root/docs-src/content
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2022-10-23 12:42:13 -0400
committerDave Henderson <dhenderson@gmail.com>2022-10-23 13:03:21 -0400
commit068013272e47549d3d6be1cf8c49b2ad6a129af9 (patch)
tree427777fced8c4cc54346e1378cce85d74935ddcd /docs-src/content
parent92891bdc6e0c31b181c585b1e1ea7e23095663f8 (diff)
Deprecate non-pipelineable strings aliases
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'docs-src/content')
-rw-r--r--docs-src/content/functions/strings.yml48
1 files changed, 43 insertions, 5 deletions
diff --git a/docs-src/content/functions/strings.yml b/docs-src/content/functions/strings.yml
index b72f7f7b..e4796bd3 100644
--- a/docs-src/content/functions/strings.yml
+++ b/docs-src/content/functions/strings.yml
@@ -139,12 +139,26 @@ funcs:
[bar baz foo]
- name: strings.Split
description: |
- Creates a slice by splitting a string on a given delimiter.
+ _Not to be confused with [`split`](#split), which is deprecated._
+
+ Slices `input` into the substrings separated by `separator`, returning a
+ slice of the substrings between those separators. If `input` does not
+ contain `separator` and `separator` is not empty, returns a single-element
+ slice whose only element is `input`.
+
+ If `separator` is empty, it will split after each UTF-8 sequence. If
+ both inputs are empty (i.e. `strings.Split "" ""`), it will return an
+ empty slice.
+
+ This is equivalent to [`strings.SplitN`](#strings-splitn) with a `count`
+ of `-1`.
+
+ Note that the delimiter is not included in the resulting elements.
pipeline: true
arguments:
- name: separator
required: true
- description: the string sequence to split
+ description: the delimiter to split on, can be multiple characters
- name: input
required: true
description: the input string
@@ -155,15 +169,33 @@ funcs:
Hello, Bart
Hello, Lisa
Hello, Maggie
+ - |
+ $ gomplate -i '{{range strings.Split "," "One,Two,Three" }}{{.}}{{"\n"}}{{end}}'
+ One
+ Two
+ Three
- name: strings.SplitN
description: |
- Creates a slice by splitting a string on a given delimiter. The count determines
- the number of substrings to return.
+ _Not to be confused with [`splitN`](#splitn), which is deprecated._
+
+ Slices `input` into the substrings separated by `separator`, returning a
+ slice of the substrings between those separators. If `input` does not
+ contain `separator` and `separator` is not empty, returns a single-element
+ slice whose only element is `input`.
+
+ The `count` determines the number of substrings to return:
+
+ * `count > 0`: at most `count` substrings; the last substring will be the
+ unsplit remainder.
+ * `count == 0`: the result is nil (zero substrings)
+ * `count < 0`: all substrings
+
+ See [`strings.Split`](#strings-split) for more details.
pipeline: true
arguments:
- name: separator
required: true
- description: the string sequence to split
+ description: the delimiter to split on, can be multiple characters
- name: count
required: true
description: the maximum number of substrings to return
@@ -523,6 +555,7 @@ funcs:
0 is 1 bytes and 1 runes
ᐰ is 3 bytes and 1 runes
- name: contains
+ deprecated: Use [`strings.Contains`](#strings-contains) instead
description: |
**See [`strings.Contains`](#strings-contains) for a pipeline-compatible version**
@@ -550,6 +583,7 @@ funcs:
no
```
- name: hasPrefix
+ deprecated: Use [`strings.HasPrefix`](#strings-hasprefix) instead
description: |
**See [`strings.HasPrefix`](#strings-hasprefix) for a pipeline-compatible version**
@@ -577,6 +611,7 @@ funcs:
foo
```
- name: hasSuffix
+ deprecated: Use [`strings.HasSuffix`](#strings-hassuffix) instead
description: |
**See [`strings.HasSuffix`](#strings-hassuffix) for a pipeline-compatible version**
@@ -602,6 +637,7 @@ funcs:
http://example.com:80
```
- name: split
+ deprecated: Use [`strings.Split`](#strings-split) instead
description: |
**See [`strings.Split`](#strings-split) for a pipeline-compatible version**
@@ -623,6 +659,7 @@ funcs:
Hello, Lisa
Hello, Maggie
- name: splitN
+ deprecated: Use [`strings.SplitN`](#strings-splitn) instead
description: |
**See [`strings.SplitN`](#strings-splitn) for a pipeline-compatible version**
@@ -646,6 +683,7 @@ funcs:
foo
bar:baz
- name: trim
+ deprecated: Use [`strings.Trim`](#strings-trim) instead
description: |
**See [`strings.Trim`](#strings-trim) for a pipeline-compatible version**