-4

I need to remove the spaces in between.

For example: "000 111 2222"

And I'd live to have: "0001112222"

How can I do this?

1 Answers1

2
var str = "000 111 2222"
let newString = str.replacingOccurrences(of: " ", with: "", options: .literal, range: nil)
print(newString)
Shabnam Siddiqui
  • 579
  • 4
  • 13