How To Get Rid Of Excess Space In Swift

[Solved] How To Get Rid Of Excess Space In Swift | Swift - Code Explorer | yomemimo.com
Question : swift remove space from string

Answered by : adventurous-anteater

let freedSpaceString = str.filter {!$0.isWhitespace}

Source : | Last Update : Wed, 19 Feb 20

Question : how to get rid of excess space in swift

Answered by : encouraging-eland-ol9hnz3fcuoq

let str = " Taylor Swift "
let trimmed = str.trimmingCharacters(in: .whitespacesAndNewlines) // prints "Taylor Swift"

Source : https://www.hackingwithswift.com/example-code/strings/how-to-trim-whitespace-in-a-string | Last Update : Sat, 06 Jun 20

Answers related to how to get rid of excess space in swift

Code Explorer Popular Question For Swift