mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-14 19:14:46 -04:00
Document strings.TrimPrefix and TrimSuffix template functions
Closes #148
This commit is contained in:
parent
80c1ce631b
commit
a2262d241e
25
content/functions/strings.TrimPrefix.md
Normal file
25
content/functions/strings.TrimPrefix.md
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
title: strings.TrimPrefix
|
||||
description: Returns a given string s without the provided leading prefix string. If s doesn't start with prefix, s is returned unchanged.
|
||||
godocref:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
keywords: [strings]
|
||||
signature: ["strings.TrimPrefix PREFIX STRING"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: [strings.TrimSuffix]
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
Given the string `"aabbaa"`, the specified prefix is only removed if `"aabbaa"` starts with it:
|
||||
|
||||
{{ strings.TrimPrefix "a" "aabbaa" }} → "abbaa"
|
||||
{{ strings.TrimPrefix "aa" "aabbaa" }} → "bbaa"
|
||||
{{ strings.TrimPrefix "aaa" "aabbaa" }} → "aabbaa"
|
25
content/functions/strings.TrimSuffix.md
Normal file
25
content/functions/strings.TrimSuffix.md
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
title: strings.TrimSuffix
|
||||
description: Returns a given string s without the provided trailing suffix string. If s doesn't end with suffix, s is returned unchanged.
|
||||
godocref:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
keywords: [strings]
|
||||
signature: ["strings.TrimSuffix SUFFIX STRING"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: [strings.TrimPrefix]
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
Given the string `"aabbaa"`, the specified suffix is only removed if `"aabbaa"` ends with it:
|
||||
|
||||
{{ strings.TrimSuffix "a" "aabbaa" }} → "aabba"
|
||||
{{ strings.TrimSuffix "aa" "aabbaa" }} → "aabb"
|
||||
{{ strings.TrimSuffix "aaa" "aabbaa" }} → "aabbaa"
|
Loading…
x
Reference in New Issue
Block a user