I am using Zxing library to scan the Barcodes. The result is stored in an NSString. Here I am looking into two cases:
Case:'semicolon' : If the result string contains semicolon character....then store it in Semicolon Array
myWords_semicolon = [_myString componentsSeparatedByCharactersInSet:
[NSCharacterSet characterSetWithCharactersInString:@";,;;"]
];
//here myWords_semicolon is a NSArray
Case: 'pipe' : If the result string contains pipe character...then store it in a pipe array.
myWords_pipe = [_myString componentsSeparatedByCharactersInSet:
[NSCharacterSet characterSetWithCharactersInString:@"|,||"]
];
What I tried to do is, if the result string contains semicolon......go to case :'semicolon' ......if the result contains pipe go to case: 'pipe'. I used this to do that but couldn't get the right solution.
if ([_myString rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@";,;;"]].location != NSNotFound) {
NSLog(@"This string doesnt contain semicolon characters");
myWords=myWords_pipe;
}
if ([_myString rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"|,||"]].location != NSNotFound) {
NSLog(@"This string doesnt contain pipe characters");
myWords=myWords_semicolon;
}
Here in this case....only semicolon is case is working,even though I scan pipe case ,the scanner is unable to recognize the pipe case.. Is there any other way to use && or || logic here?