Strip spaces from a string?

Been going through the docs but can’t seem to find it… is there no field method to simply strip all spaces from a simple text field?
Like this in twig:

{{ 'Some Text With Spaces'|replace({' ': ''}) }}

Any pointers?

In a controller or model I use Str::replace() which is the Kirby helper for string_replace().

Inside a template file I prefer to create custom field methods which might look like $page->mytextfield()->stripSpaces() (assuming the created method is named “stripSpaces”).

1 Like

Cheers, that should get me on the way. Thanks!