Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Check a string with special characters in ios

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 627
    Comment on it

    If you want to check any NSString containing special characters then check this out.

    -(BOOL)specialCharacter:(NSString*)username{
        NSCharacterSet *invalidCharSet = [[NSCharacterSet characterSetWithCharactersInString:@"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"] invertedSet];
        NSString *filtered = [[username componentsSeparatedByCharactersInSet:invalidCharSet] componentsJoinedByString:@""];
        return ![username isEqualToString:filtered];
    
    }
    
    

    Hope this will help you.

    Happy Coding!!!

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: