Objective-C Tips & Trick - Prioregroup.com
[Objective-C] Remove unused characters in a NSString
       
back

- (NSString*)removeUnusedCharacters:(NSString*)input
{
    NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"ÀÁÂÃÄâãäàÈÉÊËêëÌÍÎÏîïíÒÓÔÕÖôõöóÙÚÛÜûüùÝýñ\\|!\"£$%&/=?^+*°#§;:_`«“‘¥~‹÷´`≠¡ˆ„Ω€®™æ¨œøπ[]åß∂ƒ∞∆ªº¬@¶≤≥<>∑†©√∫˜µ…•–◊{}±¿≈⁄›‰¢’”»ı³"];
    return [[[input componentsSeparatedByCharactersInSet: doNotWant] componentsJoinedByString: @""] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
}






Copyright © 1996-2018 Centro Studi Informatica di Danilo Priore. All rights reserved. P.I.10149810581.
prioregroup.com