title: Comparing a string to an array in objective-C
body: <p>here's a very basic question, that I'm sure you will be able to answer quickly. Please don't laugh at my ignorance.</p>
  
  <p>I have a string, that I want to compare to an array of strings. Only if the string is not part of the array, I want to perform an operation. I tried the following code, that doesn't work. I do understand why, but I just can't think of a way to do it correctly.</p>
  
  <p>Please help me out of my misery.</p>
  
  <p>Thanks in advance</p>
  
  <p>Sjakelien</p>
  
  <pre><code>-(void) findRedundant: (NSString *) aString {
  #define ALPHA_ARRAY [NSArray arrayWithObjects: @"A", @"B", @"C", nil]   
      NSUInteger f;
      for (f = 0; f &lt; [ALPHA_ARRAY count]; f++) 
      {
          NSString * stringFromArray = [ALPHA_ARRAY objectAtIndex:f];
          if ([aString isEqualToString:stringFromArray]) {
              // do nothing
  
          } else {
              //do something
          }
  
      }
  
  }
  
  
  
  [self findRedundant:@"D"];
  </code></pre>