Search code examples
iphoneobjective-ciosipadipod

Where to place ||


I know that this is a really simple question, but where should I place the || below if I want to check for both CAF and AAC? Thanks!

if ([[file pathExtension] isEqualToString:@"caf"])

Solution

  • if ([[file pathExtension] isEqualToString:@"caf"] ||
        [[file pathExtension] isEqualToString:@"aac"] )
    

    Note - this is a literal comparison so it is not case insensitive - if you want to do a case insensitive comparison:

    if ([[file pathExtension] compare:@"caf" options:NSCaseInsensitiveSearch] == NSOrderedSame || 
        [[file pathExtension] compare:@"aac" options:NSCaseInsensitiveSearch] == NSOrderedSame)