mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Merge commit '35dec7c96f7ee3eb17dd444f7067f0c776fb56ae'
This commit is contained in:
@@ -1,33 +1,28 @@
|
||||
---
|
||||
title: strings.TrimRight
|
||||
description: Returns a slice of a given string with all trailing characters contained in the cutset removed.
|
||||
categories: [functions]
|
||||
description: Returns the given string, removing trailing characters specified in the cutset.
|
||||
categories: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: functions
|
||||
function:
|
||||
action:
|
||||
aliases: []
|
||||
related:
|
||||
- functions/strings/Chomp
|
||||
- functions/strings/Trim
|
||||
- functions/strings/TrimLeft
|
||||
- functions/strings/TrimPrefix
|
||||
- functions/strings/TrimSuffix
|
||||
returnType: string
|
||||
signatures: [strings.TrimRight CUTSET STRING]
|
||||
relatedFunctions:
|
||||
- strings.Chomp
|
||||
- strings.Trim
|
||||
- strings.TrimLeft
|
||||
- strings.TrimPrefix
|
||||
- strings.TrimRight
|
||||
- strings.TrimSuffix
|
||||
aliases: [/functions/strings.trimright]
|
||||
---
|
||||
|
||||
Given the string `"abba"`, trailing `"a"`'s can be removed a follows:
|
||||
|
||||
```go-html-template
|
||||
{{ strings.TrimRight "a" "abba" }} → "abb"
|
||||
{{ strings.TrimRight "a" "abba" }} → abb
|
||||
```
|
||||
|
||||
Numbers can be handled as well:
|
||||
The `strings.TrimRight` function converts the arguments to strings if possible:
|
||||
|
||||
```go-html-template
|
||||
{{ strings.TrimRight 12 1221341221 }} → "122134"
|
||||
{{ strings.TrimRight 54 12345 }} → 123 (string)
|
||||
{{ strings.TrimRight "eu" true }} → tr
|
||||
```
|
||||
|
Reference in New Issue
Block a user