2010-04-05 90 views

回答

5

使用componentsSeparatedByCharactersInSet:與由要通過拆分的任何字符的字符集。

+0

謝謝我試過: [NSCharacterSet characterSetWithCharactersInString:@「,。?!」]; 和該訣竅 – 2010-04-05 22:17:18

+1

希恩阿拉姆:空格字符不是唯一的空白字符,和那四個不是唯一的標點符號。先從'whitespaceAndNewlineCharacterSet',使一個可變的副本(不要忘記釋放或自動釋放它),工會在'punctuationCharacterSet'。 http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSMutableCharacterSet_Class/Reference/Reference.html#//apple_ref/occ/instm/NSMutableCharacterSet/formUnionWithCharacterSet: – 2010-04-06 13:44:46

相關問題