mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-05 20:25:32 +00:00
Added boolValue method to CPString
This commit is contained in:
1 parent
2eae5373bc
commit
1b2aadc6f0
1 file changed
+13
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user