美文网首页
注意使用 NSLiteralSearch 与 NSNumeric

注意使用 NSLiteralSearch 与 NSNumeric

作者: who_young | 来源:发表于2024-11-26 21:57 被阅读0次

[@"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;

相关文章

网友评论

      本文标题:注意使用 NSLiteralSearch 与 NSNumeric

      本文链接:https://www.haomeiwen.com/subject/tpfdjjtx.html