Fluid icon indicating copy to clipboard operation
Fluid copied to clipboard

f:startsWith and f:endsWith ViewHelpers

Open s2b opened this issue 6 months ago • 0 comments

Two new ViewHelpers <f:startsWith> and <f:endsWith> should be added to Fluid. <f:startsWith> checks if the subject string starts with a specified string. <f:endsWith> checks if the subject string ends with a specified string. These ViewHelpers should extend the AbstractConditionViewHelper.

Arguments:

  • string $search
  • string $subject

See also the php str_starts_with() and the php str_ends_with() functions.

Example:

<f:startsWith search="Hello" subject="Hello World">

</f:startsWith>
<f:endsWith search="World" subject="Hello World">

</f:endsWith>

<f:variable name="result" value="{myVariable -> f:startsWith(search: 'Hello')}" />

s2b avatar Jun 26 '25 12:06 s2b