Skip to content

Commit

Permalink
Cleanup hasPrefix hasSuffix
Browse files Browse the repository at this point in the history
  • Loading branch information
jmooring committed Apr 3, 2023
1 parent 7bee3e4 commit 47535dc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 31 deletions.
13 changes: 0 additions & 13 deletions content/en/functions/hasPrefix.md

This file was deleted.

13 changes: 0 additions & 13 deletions content/en/functions/hasSuffix.md

This file was deleted.

16 changes: 16 additions & 0 deletions content/en/functions/strings.HasPrefix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: strings.HasPrefix
description: Tests whether a string begins with prefix.
categories: [functions]
menu:
docs:
parent: functions
keywords: [strings]
signature: ["hasPrefix STRING PREFIX","strings.HasPrefix STRING PREFIX"]
relatedfuncs: [hasSuffix]
aliases: [/functions/hasprefix/]
---

```go-html-template
{{ hasPrefix "Hugo" "Hu" }} → true
```
11 changes: 6 additions & 5 deletions content/en/functions/strings.HasSuffix.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
title: strings.HasSuffix
description: Determine whether a given string ends with the provided trailing suffix string.
description: Tests whether a string ends with suffix.
categories: [functions]
menu:
docs:
parent: functions
keywords: [strings]
signature: ["strings.HasSuffix STRING SUFFIX"]
signature: ["hasSuffix STRING SUFFIX","strings.HasSuffix STRING SUFFIX"]
relatedfuncs: [hasPrefix]
aliases: [/functions/hassuffix/]
---

{{ $pdfPath := "/path/to/some.pdf" }}
{{ strings.HasSuffix $pdfPath "pdf" }} → true
{{ strings.HasSuffix $pdfPath "txt" }} → false
```go-html-template
{{ hasSuffix "Hugo" "go" }} → true
```

0 comments on commit 47535dc

Please sign in to comment.