• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Number formatting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 unarchiveObjectWithData:[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.

  • Follow-Ups:
    • Re: Number formatting
      • From: j o a r <email@hidden>
References: 
 >Re: Number formatting (From: j o a r <email@hidden>)

  • Prev by Date: Re: how to warn users of wrong system
  • Next by Date: Re: Authentication: Please critique my solution.
  • Previous by thread: Re: Number formatting
  • Next by thread: Re: Number formatting
  • Index(es):
    • Date
    • Thread