slicestr.md (596B)
1 ---
2 title: slicestr
3 # linktitle:
4 description: Creates a slice of a half-open range, including start and end indices.
5 date: 2017-02-01
6 publishdate: 2017-02-01
7 lastmod: 2017-02-01
8 categories: [functions]
9 menu:
10 docs:
11 parent: "functions"
12 keywords: [strings]
13 signature: ["slicestr STRING START [END]"]
14 workson: []
15 hugoversion:
16 relatedfuncs: []
17 deprecated: false
18 aliases: []
19 ---
20
21 For example, 1 and 4 creates a slice including elements 1 through 3.
22 The `end` index can be omitted; it defaults to the string's length.
23
24 * `{{slicestr "BatMan" 3}}` → "Man"
25 * `{{slicestr "BatMan" 0 3}}` → "Bat"