title: Comparing each character in an NSString against a collection of characters
body: <p>My intent is to analyze the user's input from a text field and check if he used any symbols.</p>
  
  <p>For example, user's input is "/ardv/*k" and I need a variable that says the user typed 3 symbols.</p>
  
  <p>I do not understand how to use NSRange to search against a string, because it stops as soon as it finds the first occurrence.</p>
  
  <p>Also, NSSet is not compatible with characterAtIndex selector.</p>
  
  <p>isEqualTo: didn't work.</p>
  
  <p>Here's what I did, but I want to know how I can make this code simpler if possible:</p>
  
  <pre><code>  ...
      NSString *testThisString = @"/ardv/*k";        
      NSCharacterSet *unknownFlags1 = [NSCharacterSet punctuationCharacterSet];
      NSCharacterSet *unknownFlags2 = [NSCharacterSet symbolCharacterSet];
      NSCharacterSet *unknownFlags3 = [NSCharacterSet whitespaceCharacterSet];
  
      int count = 0;
      for (int i = 0; i &lt; [testThisString length]; i++) {
      if ([unknownFlags1 characterIsMember:[testThisString characterAtIndex:i]] |
     [unknownFlags2 characterIsMember:[testThisString characterAtIndex:i]] | 
     [unknownFlags3 characterIsMember:[testThisString characterAtIndex:i]]) {
          count++;
      }
  }
      NSLog(@"There are %d unknowns", count);
    ...
  </code></pre>