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.
我是 iphone 新手。我遇到了一些问题。我有一个字符串列表,例如 1.mp3 2.mp3 3.mp3 在这里我想消除所有 .mp3 并只获得数字 1,2,3 它是怎样的可能的。如果有人知道这一点,请帮助我..
如果您要删除的项目始终是文件扩展名:
NSString *strippedString = [filename stringByDeletingPathExtension];
NSString * str =@"1.mp3"; if ([str hasSuffix:@".mp3"]) { str = [str stringByDeletingPathExtension]; NSLog(@"%@",str); }