Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
Fix issue in boolean strings to number
Browse files Browse the repository at this point in the history
  • Loading branch information
vilanovi committed May 9, 2014
1 parent 2aa03d0 commit efa7e32
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion NSObject+Motis.m
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,13 @@ - (BOOL)mts_validateAutomaticallyValue:(inout __autoreleasing id *)ioValue toCla
}
else if ([typeClass isSubclassOfClass:NSNumber.class])
{
*ioValue = @([*ioValue doubleValue]);
if ([*ioValue compare:@"true" options:NSCaseInsensitiveSearch] == NSOrderedSame)
*ioValue = @YES;
else if ([*ioValue compare:@"false" options:NSCaseInsensitiveSearch] == NSOrderedSame)
*ioValue = @NO;
else
*ioValue = @([*ioValue doubleValue]);

return *ioValue != nil;

// Using NSNumberFormatter is slower!
Expand Down

0 comments on commit efa7e32

Please sign in to comment.