我从NSString的实例方法characterAtIndex(Int)返回一个unichar类型,我想将它与
Swift类型的String进行比较.是否有捷径可寻?
var str = "#ffffff" var unichar = (str as NSString).characterAtIndex(0) var unicharString = // Perform magic var containsHash = unicharString == "#" // Should return `true`
谢谢
var str:String = "#ffffff" var unichar = str[str.startIndex] var unicharString = "\(unichar)" var containsHash = unicharString == "#"