奔五的人学ios:swift竟然没有字符串包括,找个简单的解决方法

swift关于字符串的推断中 有前导。有后缀 两个方法。竟然没有包括推断。

经过学习找了个简单的解决方法:


extension String {
    func has(v:String)->Bool {
        return self.componentsSeparatedByString(v).count > 1
    }
}


原文地址:https://www.cnblogs.com/blfbuaa/p/7390865.html