Re: Number formatting
Re: Number formatting
- Subject: Re: Number formatting
- From: John MacMullin <email@hidden>
- Date: Fri, 10 Oct 2003 15:25:22 -0700
I did try a couple of other variations and the program "kabooms". The
working code in my text printing sample is:
NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init]
autorelease];
[numberFormatter setLocalizesFormat:YES];
numberFormatter = [NSUnarchiver unarchiveObjectWith
Data:[NSArchiver
archivedDataWithRootObject: numberFormatter]];
[numberFormatter setFormat:@"$#,##0.00"];
fileFieldFourNumber = [fileFieldFourNumber
stringByAppendingString:[numberFormatter stringForObjectValue: [[[self
testFile] objectAtIndex: i] objectAtIndex: fieldFourNumberDef]]];
fileFieldFourNumber = [fileFieldFourNumber
stringByAppendingString:@"\n"];
Given the degree of help that I have had with the text architecture I
would be happy to donate the code.
Again, I greatly appreciate the help.
John
On Wednesday, October 8, 2003, at 12:01 AM, j o a r wrote:
>
Apparently that's a workaround for a bug with "setLocalizesFormat:",
>
it's in the list archives. I agree, it looks totally weird!
>
>
With this in mind it's a good thing that the first formatter is
>
autoreleased, as we'll loose all references to it after this little
>
trick. The returned formatter is also autoreleased, but that's
>
probably per design - as it's not an instance variable.
>
>
j o a r
>
>
On 2003-10-08, at 08.44, Nick Zitzmann wrote:
>
>
>> [numberFormatter setLocalizesFormat:YES];
>
>> numberFormatter = [NSUnarchiver unarchiveObjectWithData: [NSArchiver
>
>> archivedDataWithRootObject:numberFormatter]];
>
>
>
> To quote the old MPW C compiler: "Huh?"
>
_______________________________________________
>
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.