Sunday, May 12, 2013

NSString boolValue example ios


Returns the Boolean value of the receiver’s text.
- (BOOL)boolValue
Return Value of [NSString boolValue]
The Boolean value of the receiver’s text. Returns YES on encountering one of "Y", "y", "T", "t", or a digit 1-9—the method ignores any trailing characters. Returns NO if the receiver doesn’t begin with a valid decimal text representation of a number.
Discussion of [NSString boolValue]
The method assumes a decimal representation and skips whitespace at the beginning of the string. It also skips initial whitespace characters, or optional -/+ sign followed by zeroes.
Example of [NSString boolValue]
BOOL errortest = [[values valueForKey:@"isError"] boolValue];
Example of [NSString boolValue]
NSDictionary *drivingAlertResponse = [jsonResponseString objectFromJSONString];
BOOL isEnabled = [[drivingAlertResponse valueForKey:@"alertStatus"] boolValue];