---
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
```
