mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Improved -description writing/reading. Bug fixes to NSString.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2429 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
21039e770f
commit
b6e22efb49
10 changed files with 139 additions and 44 deletions
|
@ -165,6 +165,22 @@
|
|||
autorelease];
|
||||
}
|
||||
|
||||
+ valueFromString: (NSString *)string
|
||||
{
|
||||
/* FIXME: implement this better */
|
||||
const char *str;
|
||||
|
||||
str = [string cString];
|
||||
if (strchr(str, '.') >= 0 || strchr(str, 'e') >= 0
|
||||
|| strchr(str, 'E') >= 0)
|
||||
return [NSNumber numberWithDouble: atof(str)];
|
||||
else if (strchr(str, '-') >= 0)
|
||||
return [NSNumber numberWithInt: atoi(str)];
|
||||
else
|
||||
return [NSNumber numberWithUnsignedInt: atoi(str)];
|
||||
return [NSNumber numberWithInt: 0];
|
||||
}
|
||||
|
||||
/* All the rest of these methods must be implemented by a subclass */
|
||||
- (BOOL)boolValue
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue