Value of type 'String' has no member 'stringByTrimmingCharactersInSet'
The new syntax is like this:
var cString = hex.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).uppercased()
As a suggestion, you don't need to specify that cString
is a String, as this is assumed with the value you are assigning to it.
You can try this as well.
let trimmedString = hex.trimmingCharacters(in: CharacterSet.whitespaces)