我们如何比较输入的文本UITextVIew
用代码中的默认文本来确定它们是否相同?
您可以使用以下方法NSString http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/nsstring_Class/Reference/NSString.html为了这。
1: isEqualToString
: (区分大小写)
if( [ myString isEqualToString: otherString ] )
{}
2: caseInsensitiveCompare
: (不区分大小写)
if( [ myString caseInsensitiveCompare: otherString ] )
{}
3: localizedCaseInsensitiveCompare
:(不区分大小写且已本地化)
if( [ myString localizedCaseInsensitiveCompare: otherString ] )
{}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)