• 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: An Octal number into a Textfield
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: An Octal number into a Textfield


  • Subject: Re: An Octal number into a Textfield
  • From: Sherm Pendley <email@hidden>
  • Date: Tue, 13 Jun 2006 11:15:05 -0400

On Jun 13, 2006, at 8:55 AM, Andrew Knott wrote:

Hi everyone,

Just a quick one... I'm trying to get an NSTextField to display an octal number

If I have :

fileMode = 0644;

and set a textField with

[octalField setStringValue: [[NSNumber numberWithUnsignedLong:fileMode] stringValue]];

I get only the decimal version of the number? How would I get an octal representation? With a NSNumberFormatter perhaps? I don't seem to be able to find any hints...

You could use the "%o" format with sprintf(), or NSString's - stringWithFormat: to get the octal representation.


If you're using bindings your textField, or even just assigning a new value pretty often, a formatter is the way to go. But, you'll need to use the above suggestions in a subclass NSFormatter or NSNumberFormatter. As far as I know, neither one handles octal by default.

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >An Octal number into a Textfield (From: Andrew Knott <email@hidden>)

  • Prev by Date: Re: NSDocument and dealloc
  • Next by Date: Re: iTunes Library binary file
  • Previous by thread: Re: An Octal number into a Textfield
  • Next by thread: Problem fetching subentities
  • Index(es):
    • Date
    • Thread