mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
30a20122b7
# Conflicts: # docs/data/docs.yaml
866 B
866 B
title, description, categories, keywords, params, aliases
| title | description | categories | keywords | params | aliases | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| collections.Apply | Returns a slice by transforming each element of the given slice using a specific function and parameters. |
|
|
The apply function takes three or more arguments, depending on the function being applied to the slice elements.
The first argument is the slice itself, the second argument is the function name, and the remaining arguments are passed to the function, with the string "." representing the slice element.
{{ $s := slice "hello" "world" }}
{{ $s = apply $s "strings.FirstUpper" "." }}
{{ $s }} → [Hello World]
{{ $s = apply $s "strings.Replace" "." "l" "_" }}
{{ $s }} → [He__o Wor_d]