How do I remove spaces from a string in Swift? code example
Example: how to get rid of excess space in swift
let str = " Taylor Swift "
let trimmed = str.trimmingCharacters(in: .whitespacesAndNewlines) // prints "Taylor Swift"
let str = " Taylor Swift "
let trimmed = str.trimmingCharacters(in: .whitespacesAndNewlines) // prints "Taylor Swift"