how to escape special characters at once in nsstring......

Discussion in 'iOS Programming' started by Srinivas555, May 10, 2012.

  1. Srinivas555 macrumors newbie

    Joined:
    May 10, 2012
    #1
    how to escape special characters at once in nsstring......
     
  2. KnightWRX macrumors Pentium

    KnightWRX

    Joined:
    Jan 28, 2009
    Location:
    Quebec, Canada
    #2
    What do you mean ? What character ? What are you trying to escape ?

    What does your input look like, what output do you expect ?

    What have you tried ? How did it fail ?

    Code ?
     
  3. CodeBreaker macrumors 6502

    Joined:
    Nov 5, 2010
    Location:
    Sea of Tranquility
    #3
    Assuming you are replacing characters and not character sequences:

    Code:
    NSCharacterSet *theCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"+-*!%$/_"];
    
    newString = [[oldString componentsSeparatedByCharactersInSet:theCharacterSet] componentsJoinedByString:@""];
    
     

Share This Page