注意使用 NSLiteralSearch 与 NSNumeric

2024-11-26  本文已影响0人  who_young

[@"2023年10月" compare:@"2023年9月" options:NSLiteralSearch] 返回值为 NSOrderedAscending
[@"2023年10月" compare:@"2023年9月" options:NSNumericSearch] 返回值为 NSOrderedDescending
NSNumericSearch 是将字符中的数字对比,202310 > 20239;
NSLiteralSearch 是将字符中每个 character 逐个对比,2023年1 < 2023年9;

上一篇 下一篇

猜你喜欢

热点阅读