Question : remove white spaces
Answered by : muhammad-khizar-hayat
"hello world".replace(/\s/g, "");
Source : https://stackoverflow.com/questions/10800355/remove-whitespaces-inside-a-string-in-javascript | Last Update : Sun, 24 Oct 21
Question : remove whitespaces
Answered by : akash-kumar-h078bu9hbq9s
//Extenion function
fun String.removeWhitespaces() = replace(" ", "")
// Uses
var str = "This is an example text".removeWhitespaces()
println(str)
Source : https://stackoverflow.com/questions/60028103/how-to-remove-all-the-whitespaces-from-a-string-in-kotlin | Last Update : Wed, 04 Aug 21
Question : Remove White Space At Sides
Answered by : eric-tam
$x = " abc ";
print(trim($x));
There are three versions of trim().
trim(): trims white space on both ends
rtrim(): trims white space on the right end
ltrim(): trims white space on the left end
Note that trim() does not remove white space in the middle of the string.
Source : | Last Update : Sun, 10 Jul 22
Question : remove white space from start and end
Answered by : smiling-skunk-96ktnmjgs6m9
let hello = " Hello, World! ";
let wsRegex = /^\s+|\s+$/g; // Change this line
let result = hello.replace(wsRegex, ""); // Change this line
Source : https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-remove-whitespace-from-start-and-end/301362 | Last Update : Sun, 24 Apr 22