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

# EndsWith ViewHelper `<f:endsWith>` {#typo3fluid-fluid-endswith}

> [!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/EndsWith.html) instead.

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

## Examples {#examples}

### Render the body if "myString" ends with "World!" {#render-the-body-if-mystring-ends-with-world}

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

```

Output:

```php
This will be rendered if variable "myString" ends with "World!"

```

### 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:endsWith(search: 'World!', subject: myString)}">
It Works!
</f:if>

```

Output:

```php
It Works!
```

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

**Arguments**

The following arguments are available for the endsWith 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.
