NumberFormatters and sci notation
NumberFormatters and sci notation
- Subject: NumberFormatters and sci notation
- From: Graham J Lee <email@hidden>
- Date: Wed, 18 Jan 2006 14:39:35 +0000
Afternoon all,
I want to set up a NSNumberFormatter attached to a cell to display
scientific notation with a fixed precision on the mantissa, so that a
number like 0.00017234784 might be displayed as 1.72e-04. If I
attach the formatter through IB, then it just specifies strings like
@"##0,00.00" which format the example above as "0.00". I've tried
using the numberStyle, thus:
[NSNumberFormatter
setDefaultFormatterBehavior:NSNumberFormatterBehavior10_4];
NSNumberFormatter *fmt=[[[NSNumberFormatter alloc] init]
autorelease];
[fmt setNumberStyle:NSNumberFormatterScientificStyle];
[[c0Field cell] setFormatter:fmt];
but this formats the number as "1.7234784e-04". How can I restrict
the mantissa's precision while still retaining scientific notation?
Thanks,
Graham.
--
Graham Lee GPG Key ID: 01D5B9D8
UNIX Systems Manager,
Oxford Physics Practical Course
http://users.ox.ac.uk/~wadh1342 01865 273450
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden