strip_ newlines
string | strip_newlines
returns string
Strips all newline characters (line breaks) from a string.
<!-- With newlines -->
{{ product.description }}
<!-- Newlines stripped -->
{{ product.description | strip_newlines }}
<!-- With newlines -->
{{ product.description }}
<!-- Newlines stripped -->
{{ product.description | strip_newlines }}
{
"product": {
"description": "<h3>Are you low on health? Well we've got the potion just for you!</h3>\n<p>Just need a top up? Almost dead? In between? No need to worry because we have a range of sizes and strengths!</p>"
}
}
Output
<!-- With newlines -->
<h3>Are you low on health? Well we've got the potion just for you!</h3>
<p>Just need a top up? Almost dead? In between? No need to worry because we have a range of sizes and strengths!</p>
<!-- Newlines stripped -->
<h3>Are you low on health? Well we've got the potion just for you!</h3><p>Just need a top up? Almost dead? In between? No need to worry because we have a range of sizes and strengths!</p>
Was this page helpful?