diff options
Diffstat (limited to 'docs/content/en/functions/split.md')
-rw-r--r-- | docs/content/en/functions/split.md | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/docs/content/en/functions/split.md b/docs/content/en/functions/split.md index a66a7cf0c..51d1a64f7 100644 --- a/docs/content/en/functions/split.md +++ b/docs/content/en/functions/split.md @@ -1,10 +1,9 @@ --- title: split -# linktitle: split -description: splits a string into substrings separated by a delimiter +description: Returns a slice of strings by splitting STRING by DELIM. date: 2017-02-01 publishdate: 2017-02-01 -lastmod: 2017-02-01 +lastmod: 2022-11-06 categories: [functions] menu: docs: @@ -18,4 +17,14 @@ deprecated: false aliases: [] --- -* `{{split "tag1,tag2,tag3" "," }}` → ["tag1" "tag2" "tag3"] +Examples: + +```go-html-template +{{ split "tag1,tag2,tag3" "," }} → ["tag1", "tag2", "tag3"] +{{ split "abc" "" }} → ["a", "b", "c"] +``` + + +{{% note %}} +`split` essentially does the opposite of [delimit]({{< ref "functions/delimit" >}}). While `split` creates a slice from a string, `delimit` creates a string from a slice. +{{% /note %}} |