Edited at

Swift3.0でのstringByTrimmingCharactersInSetの変更点

More than 3 years have passed since last update.

string.stringByTrimmingCharactersInSetがSwift3.0で使えなくなってます。

Swift2.0

var cString:String = hex.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()).uppercaseString

Swift3.0

var cString = hex.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).uppercased()

Swift3.0では

trimmingCharacters

に変わっています。