Well, you might try NSNumberFormatter?  :-)

>From its class ref we have this pretty complex formatter: rounding,
decimal points, and different looks for positive, zero, and negative
numbers:

NSNumberFormatter *numberFormatter = 
    [[[NSNumberFormatter alloc] init] autorelease];
[numberFormatter setFormat:@"$#,###.00;0.00;($#,##0.00)"];

Then to get a formatted string you send the formmatter this:

NSString *formattedString = [numberFormatter
stringForObjectValue:anObject]; 

where anObject is an NSDecimalNumber

d


josh_feinstein wrote:
> 
> In WOS, is there a method that is able to format an NSDecimalNumber
> using a formatString that is read from a plist?
> 
> Here is my predicament:
> 
> id aDecimalNumber = [NSDecimalNumber
> decimalNumberWithString:[somedata]];
> //....some wos code
> //...........I am attempting to do something like this:
> // formattedValue = [aDecimalNumber someLovelyMethod:
> anArgumentWhoseValueIsTheResultOfAKeyInADictionary];
> //......some more wos code
> return [NSString stringWithFormat:@"<HTMLTAG
> attribute=dodadodaday>%@</HTMLTAG>", formattedValue];
> 
> Thanks,
> Joshua

Reply via email to