• 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: stringByTrimmingCharactersInSet (work-around)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stringByTrimmingCharactersInSet (work-around)


  • Subject: Re: stringByTrimmingCharactersInSet (work-around)
  • From: Jacob Engstrand <email@hidden>
  • Date: Sat, 23 Nov 2002 07:59:46 +0100

On lvrdag, nov 23, 2002, at 07:46 Europe/Stockholm, Ali Ozer wrote:

One work-around is to simply append a space to the string before trimming. Like this:

value = [value stringByAppendingString: @" "];
value = [value stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceCharacterSet]];

Not pretty, but the good thing is this code will continue to work after Apple fixes stringByTrimmingCharactersInSet:.

This is indeed a bug; see http://developer.apple.com/qa/qa2001/qa1202.html

Your workaround seems reasonable (when you want to remove characters from the whitespace set).

Ali



Ah! Of course. My mind was totally set on trimming whitespace...
Thanks
/jak
_______________________________________________
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.

References: 
 >Re: stringByTrimmingCharactersInSet (work-around) (From: Ali Ozer <email@hidden>)

  • Prev by Date: Re: stringByTrimmingCharactersInSet (work-around)
  • Next by Date: Re: Newbie with a Q?
  • Previous by thread: Re: stringByTrimmingCharactersInSet (work-around)
  • Next by thread: [QuickTime] Please let me sleep
  • Index(es):
    • Date
    • Thread