Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugoDocs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Mooring <joe.mooring@veriphor.com>2022-11-07 08:32:18 +0300
committerGitHub <noreply@github.com>2022-11-07 08:32:18 +0300
commit7db6f0c0185be205f1318d7537f3defce34425c3 (patch)
tree751b1428799bea9b1f214072f811636256a01f84
parentbe87dba80df0ccd826ddb4539a186adef94c9d24 (diff)
Add example to split function (#1867)
-rw-r--r--content/en/functions/split.md13
1 files changed, 9 insertions, 4 deletions
diff --git a/content/en/functions/split.md b/content/en/functions/split.md
index 44cab8e6e..51d1a64f7 100644
--- a/content/en/functions/split.md
+++ b/content/en/functions/split.md
@@ -1,10 +1,9 @@
---
title: split
-# linktitle: split
-description: Returns an array of strings by splitting STRING by DELIM.
+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,7 +17,13 @@ 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.