Try:
var sample_str = "PB 10 CV 2662" var new_str = sample_str.split(" ").join("")
Or you can use .replace with a global flag:
var sample_str = "PB 10 CV 2662" var new_str = sample_str.replace(" ","","g")
Both will cause new_str to be equal to "PB10CV2662". I hope this is useful to you.
source share