How do I write an IF ELSE to check string contents of an array?
Posted
by Michael Robinson
on Stack Overflow
See other posts from Stack Overflow
or by Michael Robinson
Published on 2010-03-19T21:07:17Z
Indexed on
2010/03/19
21:11 UTC
Read the original article
Hit count: 373
I'm trying to write an IF ELSE statement to enable shipping, If user doesn't add an address the array contents remain as "-" & "-" for the two items in the array. I want to check to see if those are in the array, if they are then I want to enableshipping.
Here is the code for getting the array:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fullFileName = [NSString stringWithFormat:@"%@/arraySaveFile", documentsDirectory];
NSMutableArray *array = [[NSMutableArray alloc] initWithContentsOfFile:fullFileName];
How do I write this first line to look for the "-" & "-"?
if ([fullFileName isEqualToString:@"-","-"])
{
[nnNEP EnableShipping];
}
else {
[nnNEP DisableShipping];
}
Thanks,
michael
© Stack Overflow or respective owner