This is my code:
NSString * atime = [NSString stringWithFormat:@\"%@\",[theDataObject.minuteArray objectAtIndex:indexPath.row]];
NSLog(@\"value of atime is:%@\"
isEqualToString: ->
- (BOOL)isEqualToString:(NSString *)aString
Returns a Boolean value that indicates whether a given string is equal to the receiver using a literal Unicode-based comparison.
Discussion -> When this method compares two strings, if the individual Unicodes are the same, then the strings are equal
For more you can access apple NSString Class Reference
if([atime isEqualToString:@"0"])
{
}
else
{
}
Try the following:
if ([atime isEqualToString : @" "]) {}
if (atime==@"0")
Compares the memory address of atime
with the address of constant string @"0"
.
if ([atime isEqualToString:@"0"])
Compares the values that are stored in the two memory locations.
From your requirement it is seen that you want to compare the value not the memory location. So go for 2nd one.