Re: scientific number formatter
Re: scientific number formatter
- Subject: Re: scientific number formatter
- From: Jonathan Jackel <email@hidden>
- Date: Thu, 13 Feb 2003 21:17:26 -0500
I thought what you wanted was an NSFormatter subclass. For the hell of
it, I whipped one up myself. Here's a link to a demo project:
http://mywebpages.comcast.net/jjackel/DemoFormatter.tgz
The formatter itself is three lines of code. You'd probably want to
build in some validation, but the basic functionality is there.
Jonathan
On Thursday, February 13, 2003, at 11:53 AM, olivier wrote:
the way to do it for the archive
NSString numberString = @"2e8" ;
double thenumber = [ numberString doubleValue];
NSNumber *number = [NSNumber numberWithDouble: theNumber];
Olivier
On Wednesday, February 12, 2003, at 01:18 PM, olivier wrote:
well really i know how to get a string value from the number my
biggest concern is the other way around, getting a number from a
string.
I tried setting a formatter to use the %e, but could not do it.
Olivier
On Wednesday, February 12, 2003, at 12:26 PM, Jonathan E. Jackel
wrote:
Seems pretty trivial, given that you can use stringWithFormat and %e
to do
the formatting. The hard part would be learning how formatters work.
There's example code in Chapter 18 (I think) of Cocoa Programming.
You can
download the code from:
http://www.cocoaprogramming.net/Downloads.html
Jonathan
-----Original Message-----
From: email@hidden
[mailto:email@hidden]On Behalf Of olivier
Sent: Wednesday, February 12, 2003 12:19 PM
To: cocoa apple
Subject: scientific number formatter
i need to display number like so: 125E-16
I looked on the web and could not find any. Does anybody if somebody
already implemented one and shared the code somewhere on the web.
I'd
hate to duplicate somebody else effort.
Olivier
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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.