mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Merge commit 'f96384a3b596f9bc0a3a035970b09b2c601f0ccb'
This commit is contained in:
@@ -1,23 +1,15 @@
|
||||
---
|
||||
title: substr
|
||||
# linktitle:
|
||||
description: Extracts parts of a string from a specified character's position and returns the specified number of characters.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
parent: functions
|
||||
keywords: [strings]
|
||||
aliases: []
|
||||
signature:
|
||||
- "substr STRING START [LENGTH]"
|
||||
- "strings.Substr STRING START [LENGTH]"
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
---
|
||||
|
||||
It normally takes two parameters: `start` and `length`. It can also take one parameter: `start`, i.e. `length` is omitted, in which case the substring starting from start until the end of the string will be returned.
|
||||
@@ -26,7 +18,7 @@ To extract characters from the end of the string, use a negative start number.
|
||||
|
||||
If `length` is given and is negative, that number of characters will be omitted from the end of string.
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{ substr "abcdef" 0 }} → "abcdef"
|
||||
{{ substr "abcdef" 1 }} → "bcdef"
|
||||
|
||||
|
Reference in New Issue
Block a user