Comments (4)
我是在getFirstLetter方法里面做出的修改,如果有问题还望斧正
for (NSString* word in wordArr) {
//如果word是小写 为汉字转的拼音 提取首字符 否则 保留全部
if (word.length == 0) {
} else {
NSInteger c_index = [wordArr indexOfObject:word];
NSString* c;
if (c_index == 0) {
c = word;
} else {
if (word.length > 1) {
c = [word substringToIndex:0];
} else {
c = @"a";
}
}
// char c = [word characterAtIndex:0];
// if ((c>96)&&(c<123)) {
// [result appendFormat:@"%c",c];
// }else{
[result appendString:word];
// }
}
}
from bmchinesesort.
我是在getFirstLetter方法里面做出的修改,如果有问题还望斧正
for (NSString* word in wordArr) {
//如果word是小写 为汉字转的拼音 提取首字符 否则 保留全部
if (word.length == 0) {
} else {
NSInteger c_index = [wordArr indexOfObject:word];
NSString* c;
if (c_index == 0) {
c = word;
} else {
if (word.length > 1) {
c = [word substringToIndex:0];
} else {
c = @"a";
}
}
// char c = [word characterAtIndex:0];
// if ((c>96)&&(c<123)) {
// [result appendFormat:@"%c",c];
// }else{
[result appendString:word];
// }
}
}
from bmchinesesort.
我大致了解你的需求了。评论一下。
1、不应该在这个getFirstLetter方法里改,这只是一个单纯返回首字母的方法,改了方法名和实际返回结果不同了。
2、你的写法也没满足你的需求,只能区分拼音不同的,对于“赵”和“招”,你还是会乱
3、如果想区分汉字,应该对汉字做处理,不是对拼音做处理。在排序比较的时候,改进用于比较的key
“首字母” 改进为-> “首字母”+“首汉字的unicode”
4、最后在分组和排序的时候做出响应的改进。
from bmchinesesort.
这只是我暂时想到的思路。
另外说一下,抱歉这么久才看到,经常不注意noti。
我已经转swift很久了,所以oc版本应该随缘更新了。
下次更新为swift版本更新缓存机时,会一起改进这个需求的。最后感谢你的提议🙏
from bmchinesesort.
Related Issues (18)
- 当姓名为特殊字符会发生崩溃 HOT 1
- 拼音常量分离
- 重庆的怎么跑到Z那里去了啊
- 将BMCHineseSort添加进项目后,编译报错 HOT 1
- 多音字的问题怎么解决呢
- 字符连续空格崩溃
- 模式1和2一样
- 你好 能将#组放在所有分组的最后面吗 现在是第一个 HOT 1
- License?
- 如果model的属性中有下划线等特殊字符,会自动过滤! HOT 1
- 同一拼音首字母时顺序错乱 HOT 3
- [BMChineseSort sortAndGroup:key:finish:]_block_invoke (BMChineseSort.m:162) HOT 1
- BMChineseSort配合UISearchBar同时使用报错 HOT 1
- 特殊字符怎么分组排序到最后呢 HOT 2
- Semaphore object deallocated while in use Abort Cause 1 报错 HOT 1
- 能不能支持一下CocoaPods, SPM???? HOT 7
- 一字特殊字符,空字符串崩溃
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bmchinesesort.