Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stripping / Removing characters from String



What is the best way to remove "invalid" characters from a NSString. I tried the following :


NSCharacterSet * invalidCharacters = [[NSCharacterSet alphanumericCharacterSet]invertedSet];
NSString * firstName = [input stringByTrimmingCharactersInSet:invalidCharacters];


But this only removes characters on the start and end of the string. I searched quite a bit for a method to
remove characters from a NSString. Of course I could parse it myself, but I am hopeful that there is a
better way. Surely this has been addressed.




Alexander Hartner
email@hidden

Thus spake the master programmer:
``Let the programmers be many and the managers few - then all will be productive.''
- The Tao of Programming





_______________________________________________

Cocoa-dev mailing list (email@hidden)

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/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.