• 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: Nick Zitzmann <email@hidden>
  • Date: Tue, 7 Oct 2003 23:44:37 -0700

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.
  • Follow-Ups:
    • Re: Number formatting
      • From: John MacMullin <email@hidden>
    • Re: Number formatting
      • From: j o a r <email@hidden>
References: 
 >Re: Number formatting (From: John MacMullin <email@hidden>)

  • Prev by Date: Re: Number formatting
  • Next by Date: Re: Number formatting
  • Previous by thread: Re: Number formatting
  • Next by thread: Re: Number formatting
  • Index(es):
    • Date
    • Thread