Compare two strings?
This question already has an answer here:
if "test".contains("es") {
//...
}
Don't use NSString
in Swift. Use String
(which is also the default when you create Strings).
Anyway, contains()
is what you're looking for.
if "test".contains("es") {
// this will run
}
链接地址: http://www.djcxy.com/p/74008.html
下一篇: 比较两个字符串?