简体   繁体   中英

Remove all qoutes from a string iOS Swift

I've seen solutions for objective-c but not for swift. I'm new to iOS development, any help would greatly be appreciated

I want to remove all " from this string:

 let test:NSString = jsonData.valueForKey("test") as! NSString

The method stringByReplacingOccurrencesOfString(_:withString) will do the trick:

let myString = "\"test\""
let noQuotes = myString.stringByReplacingOccurrencesOfString( "\"", withString: "" )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM