• 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
NSNumberFormatter forbidding non-digits?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSNumberFormatter forbidding non-digits?


  • Subject: NSNumberFormatter forbidding non-digits?
  • From: "Paul J. Lucas" <email@hidden>
  • Date: Tue, 8 Nov 2005 21:08:15 -0800 (PST)

	I have an NSTextField with an attached NSNumberFormatter.
	Actually, the class is derived from NSNumberFormatter.  It
	overrides isPartialStringValid to trap keystrokes as the user
	types them.  The first thing I do is to call super's
	isPartialStringValid.  If the returns false, I do nothing more.

	I would have expected it to return false if the user types a
	non-digit to disallow entering of non-digits (and beep).  But it
	allows non-digits.  (I do a setFormat:@"0" on the formatter.)

	Why doesn't my formatter reject non-digits?  How can I make it
	reject nondigits short of checking for it myself?  (I thought
	that's the point of using a NSNumberFormatter so you don't have
	to check for non-digits yourself.)

	- Paul
 _______________________________________________
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

  • Prev by Date: Re: Trouble with MakeFSSpec
  • Next by Date: Re: progress bar when creating file
  • Previous by thread: Re: Borderless NSWindow contentView problem
  • Next by thread: authenticate per user
  • Index(es):
    • Date
    • Thread