baymax0 / bmchinesesort Goto Github PK
View Code? Open in Web Editor NEWBMChineseSort是一个为模型、字典、字符串数组根据特定中文属性基于tableview分组优化的工具类,基于异步、多线程降低排序时间。
License: Other
BMChineseSort是一个为模型、字典、字符串数组根据特定中文属性基于tableview分组优化的工具类,基于异步、多线程降低排序时间。
License: Other
一字特殊字符,空字符串解析崩溃
奔溃位置:254行,数组越界( [result appendString:[letter substringToIndex:1]];)
解决方法:NSRange urgentRange = [str rangeOfCharacterFromSet: [NSCharacterSet characterSetWithCharactersInString: @",.?、¥#&<>《》()[]{}【】^@/£¤|§¨「」『』¢¬ ̄@#&*()——+|《》$_€"]];里面新增一个空格字符
特殊字符怎么分组排序到最后呢,最好给个枚举能根据枚举更改特殊字符的分组呢
在姓氏中沈姓归类到 C中了,应该归类到S中,这个怎么解决呢
谷歌了下,
` semaphore = dispatch_semaphore_create(1);
//异步执行
dispatch_async(dispatch_get_global_queue(0, 0), ^{
//将数据 转换为 BMChineseSortModel
NSMutableArray *sortModelArray = [NSMutableArray arrayWithCapacity:0];
[objectArray enumerateObjectsWithOptions:NSEnumerationConcurrent usingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
BMChineseSortModel *model = [self getModelWithObj:obj key:key];
if (model) {
//对 数组的插入操作 上锁
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
[sortModelArray addObject:model];
dispatch_semaphore_signal(semaphore);
}
}];`
系统判断sema是否被使用的标志为sema被销毁时的值是否与初始化的值相同
刚才提交了一个commit,楼主看下。刚开始下载的时候打开一看我就被吓到了,那个字符数组的长度比代码都多,常量是不应该这样放的,不太好。我把常量单独分离出来弄了一个单独的常量头文件,你看下
当姓名为“#”或者“?”等特殊字符时会崩溃在 NSString *pinyin = [str substringToIndex:1];这一句,原因是ReturnSortObjectArrar方法返回特殊字符时chineseString.pinYin = @""导致crash,改成chineseString.pinYin = @"#";解决问题
能不能支持一下CocoaPods, SPM????
比如:
1.李某、刘某(这是正常顺序)。现在排出来的结果是刘某、李某。
2.韩某、韩某某、贺某(这是正常顺序)。现在排出来的结果是韩某、贺某、韩某某。
环境:xcode9 iOS 11
我下载你的demo,运行没有问题.
吧BMChineseSort文件拖入我的项目, import 也没问题, 写好代码运行时却报错,在Stack Overflow上找了好几个类似问题的解决方法,都没有成功.
Undefined symbols for architecture arm64:
"OBJC_CLASS$_BMChineseSort", referenced from:
objc-class-ref in AddressListViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
多次尝试一直报错,请问正确的使用方法是什么样的呢?
BMChineseSort是个很高效的库
但是对于通讯录这块
产品要求同姓的放在一起
“张a”、“赵b”、“张c”、“赵e”、“赵a”
BMChineseSort排序为: “张a”、“赵b”、“张c”、“赵e”
实际要求为: “张a”、“张c”、“赵a”、“赵b”、“赵e”
如果model的属性中有下划线等特殊字符,会自动过滤!
Hello,
Do you have a license for your software, such as the MIT License, or BSD License?
Thank you,
你好,
您是否拥有软件许可证,例如MIT许可证或BSD许可证?
谢谢,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.