mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-25 22:00:58 +02:00
Merge commit '9b0050e9aabe4be65c78ccf292a348f309d50ccd' as 'docs'
``` git subtree add --prefix=docs/ https://github.com/gohugoio/hugoDocs.git master --squash ``` Closes #11925
This commit is contained in:
25
docs/content/en/functions/strings/Count.md
Normal file
25
docs/content/en/functions/strings/Count.md
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
title: strings.Count
|
||||
description: Returns the number of non-overlapping instances of the given substring within the given string.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: []
|
||||
related:
|
||||
- functions/go-template/len
|
||||
- functions/strings/CountRunes
|
||||
- functions/strings/CountWords
|
||||
- functions/strings/RuneCount
|
||||
returnType: int
|
||||
signatures: [strings.Count SUBSTR STRING]
|
||||
aliases: [/functions/strings.count]
|
||||
---
|
||||
|
||||
If `SUBSTR` is an empty string, this function returns 1 plus the number of Unicode code points in `STRING`.
|
||||
|
||||
```go-html-template
|
||||
{{ "aaabaab" | strings.Count "a" }} → 5
|
||||
{{ "aaabaab" | strings.Count "aa" }} → 2
|
||||
{{ "aaabaab" | strings.Count "aaa" }} → 1
|
||||
{{ "aaabaab" | strings.Count "" }} → 8
|
||||
```
|
Reference in New Issue
Block a user