Answers for "strip whitespaces"

CSS
0

remove whitespaces

//Extenion function
fun String.removeWhitespaces() = replace(" ", "")

// Uses
var str = "This is an example text".removeWhitespaces()

println(str)
Posted by: Guest on July-28-2021
0

Trim whitespaces around string, but not inside of string.

$cleanStr = trim(preg_replace('/\s\s+/', ' ', str_replace("\n", " ", $str)));
Posted by: Guest on February-02-2022

Browse Popular Code Answers by Language