mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-13 15:16:52 -04:00
Add example to split function (#1867)
This commit is contained in:
parent
be87dba80d
commit
7db6f0c018
@ -1,10 +1,9 @@
|
|||||||
---
|
---
|
||||||
title: split
|
title: split
|
||||||
# linktitle: split
|
description: Returns a slice of strings by splitting STRING by DELIM.
|
||||||
description: Returns an array of strings by splitting STRING by DELIM.
|
|
||||||
date: 2017-02-01
|
date: 2017-02-01
|
||||||
publishdate: 2017-02-01
|
publishdate: 2017-02-01
|
||||||
lastmod: 2017-02-01
|
lastmod: 2022-11-06
|
||||||
categories: [functions]
|
categories: [functions]
|
||||||
menu:
|
menu:
|
||||||
docs:
|
docs:
|
||||||
@ -18,7 +17,13 @@ deprecated: false
|
|||||||
aliases: []
|
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 %}}
|
{{% 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.
|
`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.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user