• 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: Stripping newlines/blanks when pasting on an NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stripping newlines/blanks when pasting on an NSTextField


  • Subject: Re: Stripping newlines/blanks when pasting on an NSTextField
  • From: "I. Savant" <email@hidden>
  • Date: Sat, 28 Oct 2006 19:22:33 -0400

On Oct 28, 2006, at 6:59 PM, Michele Balistreri wrote:
Thank you for your help. In the end i just used a formatter also implementing isPartialString.. to be called at each keypress

Ha! Serves me right for not double-checking the docs before answering. In my defense, I haven't needed much beyond a number or date formatter in my ventures and the few times I have, it's been a "correct or nothing" situation. As a result I had completely forgotten about that method. Regardless, insert your local 'no excuse' idiom here. ;-)


As to a more flexible way to filter strings, I would definitely use NSScanner's -scanCharactersFromSet:intoString: method to filter a string for any character set (including newlines, etc.). You can easily create a reusable "MyStringFilteringFormatter" subclass if you want, that allows you to set which characters it should filter. This way, the actual character set you're filtering doesn't matter so you can reuse this formatter anywhere to filter a variety of things. Of course it's up to you to supply the character set.

  I hope at least *that* is helpful. :-)

--
I.S.



_______________________________________________
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


  • Follow-Ups:
    • Re: Stripping newlines/blanks when pasting on an NSTextField
      • From: Michele Balistreri <email@hidden>
References: 
 >Stripping newlines/blanks when pasting on an NSTextField (From: Michele Balistreri <email@hidden>)
 >Re: Stripping newlines/blanks when pasting on an NSTextField (From: Rosyna <email@hidden>)
 >Re: Stripping newlines/blanks when pasting on an NSTextField (From: "I. Savant" <email@hidden>)
 >Re: Stripping newlines/blanks when pasting on an NSTextField (From: Rosyna <email@hidden>)
 >Re: Stripping newlines/blanks when pasting on an NSTextField (From: "I. Savant" <email@hidden>)
 >Re: Stripping newlines/blanks when pasting on an NSTextField (From: Rosyna <email@hidden>)
 >Re: Stripping newlines/blanks when pasting on an NSTextField (From: Michele Balistreri <email@hidden>)
 >Re: Stripping newlines/blanks when pasting on an NSTextField (From: "I. Savant" <email@hidden>)
 >Re: Stripping newlines/blanks when pasting on an NSTextField (From: Michele Balistreri <email@hidden>)

  • Prev by Date: Re: Stripping newlines/blanks when pasting on an NSTextField
  • Next by Date: Re: Stripping newlines/blanks when pasting on an NSTextField
  • Previous by thread: Re: Stripping newlines/blanks when pasting on an NSTextField
  • Next by thread: Re: Stripping newlines/blanks when pasting on an NSTextField
  • Index(es):
    • Date
    • Thread