IOS???????????????
???????????? ???????[ 2014/9/15 11:16:46 ] ??????????????? iOS ????
??????????????????????????????????????????л??????????????????????????????????????????????Щ??????????????????б????????????????“???[??Ц]??[????]”???????????????????????????????????????????????????????潫?????????????????????
??????????????IOS?????е???????.plist?? ???????????????TextView?????????????á?
??????????????·????????????????????????????????range?? ?????range??????????е?????????????[????]?? ???[????] ??????.plist??item?μ?chs????????????????????????????????????????????????????????????滻???ɡ???????????????????????????????
????1.????????????????????????????飬?????????????????????????????.plist????????????????????????д洢??????????????????root????????飬?????е?item????????????д??????????????????????????????????????????????????????????????
????2.??δ?.plist????л??????????????bundle???????????·????????????·?????????飬?????д洢????????????е???????????£?
????//????plist????е?????
????NSBundle *bundle = [NSBundle mainBundle];
????//????????·??
????NSString *path = [bundle pathForResource:@"emoticons" ofType:@"plist"];
????//???plist?е?????
????NSArray *face = [[NSArray alloc] initWithContentsOfFile:path];
????3.??????????????????????????????κα??飬?????滻??
????//??????????????????????·???????????????
????NSString *str = @"??[Χ??]??[????]??[????]??[????]??[????]??[??]??[?]??[???]??[?][123456]";
????4.???????str???????????????????????????????????????????TextView???????????????????????????£?
????//????????????????????
????NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:str];
????5.?????????????????????????????е??Χ???????????????????[/*]??????[123567]????????????????????????????
????//?????????滻????????Χ
????//???????
????NSString * pattern = @"\[[a-zA-Z0-9\u4e00-\u9fa5]+\]";
????NSError *error = nil;
????NSRegularExpression * re = [NSRegularExpression regularExpressionWithPattern:pattern options:NSRegularExpressionCaseInsensitive error:&error];
????if (!re) {
????NSLog(@"%@"?? [error localizedDescription]);
????}
????//????????????????????
????NSArray *resultArray = [re matchesInString:str options:0 range:NSMakeRange(0?? str.length)];
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11