Reputation: 196
I am new to smarty.
I want to know how to remove all white-space characters from a given string in Smarty?
I have a string like "this is my string". The output should be "thisismystring".
How can I do this?
Upvotes: 5
Views: 22600
Reputation: 460
This is what you need.
{$your_variable|regex_replace:'/\s+/':''}
Upvotes: 0
Reputation: 1054
You can strip whitespace from a variable (string) by using the strip
modifier, and passing an empty string to it as an argument:
{$myVar|strip:""}
Upvotes: 0
Reputation: 12820
anything between strip, all spaces will be removed.
{strip}{/strip}
Upvotes: 6