-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 3/17/11 7:03 AM, Heizer, Charles wrote: > Hello, > I would like to know how to remove certain characters from a NSString. The > characters are "©". I thought I could just use encodings and convert the > string using NSASCIIStringEncoding but that did not work and I'm not sure > what the car codes are for these as well.
Perhaps I am missing something, but since NSString handles Unicode fine, just use either NSString's stringByReplacingOccurrencesOfString:withString: or NSMutableString's replaceOccurrencesOfString:withString:options:range: ? This makes for less work and more readable code since you should be able to literally paste the "foreign" characters into your search string and not have to fuss around with character codes. Of course, if your input contains the problem characters in multiple underlying representations (say, from different languages), this complicates matters. Such a situation happened to me a while back, wherein an application on the system and the terminal had different notions of how to store accented characters. Suffice it to say this led to much hair pulling when it came time to do source code management ("file X is been added, file X has been removed"). - -- Conrad Shultz Synthetiq Solutions www.synthetiqsolutions.com -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.14 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk2CGzoACgkQaOlrz5+0JdWj4ACfd2ZCBIVmqGjFT29EmBE7tdaS D/cAnRsLDoDRD3r336J27udk6GTpCh/j =eAiC -----END PGP SIGNATURE----- _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com