Re: double to NSString
Re: double to NSString
- Subject: Re: double to NSString
- From: lbland <email@hidden>
- Date: Thu, 3 Jul 2003 20:43:29 -0400
On Thursday, July 3, 2003, at 07:17 PM, John Randolph wrote:
One other way:
float someQuantity;
NSSString *myFloatString = [[NSNumber numberWithFloat:someQuantity]
stringValue];
hi-
note the following:
double x = 10.1234567891234;
NSString *myString = [[NSNumber numberWithDouble:x] stringValue];
NSLog(@"myString: %@", myString);
myString = [NSString stringWithFormat:@"%g", x];
NSLog(@"myString: %@", myString);
printf("x:@.20g\n", x);
gives:
2003-07-03 20:38:52.884 testapp[701] myString: 10.1234567891234
2003-07-03 20:38:52.896 testapp[701] myString: 10.1235
x: 10.123456789123400412
I assume you understand the implications, and that there are different
ways, not all the same.
Lance Bland
mailto:email@hidden
VVI
888-VVI-PLOT
http://www.vvi.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.