---
title: "StartsWith ViewHelper <f:startsWith>"
manual: "Fluid Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/fluid:typo3fluid-fluid-startswith"
source: "ViewHelpers/Fluid/StartsWith.rst"
rendered: "2026-10-08T14:12:40+00:00"
---

# StartsWith ViewHelper `<f:startsWith>` {#typo3fluid-fluid-startswith}

> [!NOTE]
> This reference is part of the documentation of Fluid Standalone.
> If you are working with Fluid in TYPO3 CMS, please refer to
> [TYPO3's ViewHelper reference](https://docs.typo3.org/other/typo3/view-helper-reference/14.3/en-us/Global/StartsWith.html) instead.

StartsWith ViewHelper checks if the subject string starts with a specified string.
This ViewHelper implements an if/else condition.

## Examples {#examples}

### Render the body if "myString" starts with "Hello" {#render-the-body-if-mystring-starts-with-hello}

```php
<f:variable name="myString" value="Hello, World!" />
<f:startsWith search="Hello" subject="{myString}">This will be rendered if variable "myString" starts with "Hello"</f:startsWith>

```

Output:

```php
This will be rendered if variable "myString" starts with "Hello"

```

### A more complex example with inline notation {#a-more-complex-example-with-inline-notation}

```php
<f:variable name="condition" value="{false}" />
<f:variable name="myString" value="Hello, World!" />

<f:if condition="{condition} || {f:startsWith(search: 'Hello', subject: myString)}">
It Works!
</f:if>

```

Output:

```php
It Works!
```

Go to the source code of this ViewHelper: [StartsWithViewHelper.php (GitHub)](https://github.com/TYPO3/Fluid/blob/main/src/ViewHelpers/StartsWithViewHelper.php).

**Arguments**

The following arguments are available for the startsWith ViewHelper:

-   **else**

    -   *Type:* mixed

    Value to be returned if the condition if not met.

-   **search**

    -   *Type:* string
    -   *Required:* true

    String to search in subject at the beginning

-   **subject**

    -   *Type:* string
    -   *Required:* true

    String to search in

-   **then**

    -   *Type:* mixed

    Value to be returned if the condition if met.
