Re: Number formatting
Re: Number formatting
- Subject: Re: Number formatting
- From: John MacMullin <email@hidden>
- Date: Wed, 8 Oct 2003 12:20:51 -0700
Thank you. The altered workaround code does work now. However, I more
than likely will be asking some memory questions as the program works
fine for several iterations then hangs with the spinning ball!!
John
On Tuesday, October 7, 2003, at 11:44 PM, Nick Zitzmann wrote:
On Tuesday, October 7, 2003, at 11:28 PM, John MacMullin wrote:
Again, the workaround code is:
NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init]
autorelease];
Here the program creates an autoreleased NSNumberFormatter.
[numberFormatter setLocalizesFormat:YES];
numberFormatter = [NSUnarchiver unarchiveObjectWithData: [NSArchiver
archivedDataWithRootObject:numberFormatter]];
To quote the old MPW C compiler: "Huh?"
[numberFormatter setFormat:@"$#,##0.00"];
[numberFormatter stringForObjectValue:[[[self
testFile]objectAtIndex:i]objectAtIndex:fieldFourNumberDef]];
fileFieldFourNumber = [fileFieldFourNumber
stringByAppendingString:[NSString stringWithFormat:@"%@",
numberFormatter]];
The third line in the block above is trying to get the description of
the NSNumberFormatter, which is exactly what you're getting in the
results (since NSNumberFormatter does not subclass -description). What
you probably want to do instead is append the string that was
generated in second line but not used or preserved anywhere...
Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page: http://seiryu.home.comcast.net/
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone." - Bjarne Stroustrup
_______________________________________________
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.