Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个NSMutableString. 我需要检查最后一个字符是@“:”还是最后两个字符是@“:”
NSMutableString
怎么做?
使用 的hasSuffix:方法NSString。
hasSuffix:
NSString
标识最后一个 char:
NSString *lastChar = [yourstr substringFromIndex: [yourstr length] - 1];
标识最后两个字符:
NSString *lastTwoChar = [yourstr substringFromIndex: [yourstr length] - 2];