Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个 NSString 存储在一个变量中,我总是希望将字符串保留到我的第 10 个字符并删除其余字符。我如何在 Objective-C 中做到这一点?
NSMutableString *tmp = [NSMutableString stringWithString:@"012346578901234567890"]; [tmp replaceCharactersInRange:NSMakeRange(10, tmp.length-10) withString:@""]; NSLog(@"tmp : %@",tmp);