Replace Character In Swift

[Solved] Replace Character In Swift | Swift - Code Explorer | yomemimo.com
Question : how to replace certain characters in string swift

Answered by : encouraging-eland-ol9hnz3fcuoq

let aString = "This is my string"
let newString = aString.replacingOccurrences(of: " ", with: "+", options: .literal, range: nil)

Source : https://stackoverflow.com/questions/24200888/any-way-to-replace-characters-on-swift-string | Last Update : Sat, 06 Jun 20

Question : replace character in swift

Answered by : mobile-star

extension String {	func withReplacedCharacters(_ oldChar: String, by newChar: String) -> String { let newStr = self.replacingOccurrences(of: oldChar, with: newChar, options: .literal, range: nil) return newStr	}
}

Source : | Last Update : Thu, 13 Feb 20

Answers related to replace character in swift

Code Explorer Popular Question For Swift