title: validate alphanumeric value in UITextField
body: <p>I want alphanumeric value in textfield.If user enter only character or number then sending massage.Even no special characters acceptable.</p>
  
  <pre><code>        NSString *str = askIdTxt.text;
          NSCharacterSet *alphanumericSet = [NSCharacterSet alphanumericCharacterSet];
          NSCharacterSet *numberSet = [NSCharacterSet decimalDigitCharacterSet];
          BOOL isAlphaNumericOnly = [[str stringByTrimmingCharactersInSet:alphanumericSet] isEqualToString:@""] &amp;&amp; ! [[str stringByTrimmingCharactersInSet:numberSet] isEqualToString:@""];
          if (isAlphaNumericOnly) {
               NSLog(@"isAplhaNumericOnly: %@",(isAlphaNumericOnly? @"Yes":@"No"));
          }
  </code></pre>
  
  <p>This is always returning true. I am not getting what is wrong in this.</p>