Added boolValue method to CPString

This commit is contained in:
vijaykiran committed 2008-09-14 11:35:28 +02:00
1 parent 2eae5373bc
commit 1b2aadc6f0
1 file changed
+13
+13
View File
@@ -460,6 +460,19 @@ CPNumericSearch
return eval(self);
}
/*
Returns <code>YES</code> on encountering one of "Y", "y", "T", "t", or
a digit 1-9. Returns <code>NO</code> otherwise. This method skips the initial
whitespace characters, +,- followed by Zeroes.
*/
- (BOOL)boolValue
{
aString = self.replace(/^\s+[\+,-]*0*/,"");
if(aString.match(/[Y,y,t,T,[1-9]/) != null)
return YES;
return NO;
}
/*
Returns the text as a float point value.
*/