• 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
NSString stringByTrimmingCharactersInSet method doesnt work.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSString stringByTrimmingCharactersInSet method doesnt work.


  • Subject: NSString stringByTrimmingCharactersInSet method doesnt work.
  • From: Alex.Wang <email@hidden>
  • Date: Tue, 23 Dec 2008 18:00:42 +0000

Hi everyone.
I came across a confusing issue, please see the following code:

NSLog(@"Trick here: %@", [[NSString stringWithString:@"There    are
blanks"]
                              stringByTrimmingCharactersInSet:
                              [NSCharacterSet
whitespaceAndNewlineCharacterSet]]);

We may expect to see "Trick here: Thereareblanks" output from the console.
However, I got "Trick here: There    are    blanks" instead. I dont know why
the  stringByTrimmingCharactersInSet method doesn't work.
Can anyone here give me an explanation or tell me how to solve it?
Thank you very much for your help. Good luck.

--
Best regards.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSString stringByTrimmingCharactersInSet method doesnt work.
      • From: Graham Cox <email@hidden>
    • Re: NSString stringByTrimmingCharactersInSet method doesnt work.
      • From: j o a r <email@hidden>
  • Prev by Date: Re: Drawing in a NSView out side of drawRect
  • Next by Date: Re: NSString stringByTrimmingCharactersInSet method doesnt work.
  • Previous by thread: Re: Cocoa-dev Digest, Vol 5, Issue 2199
  • Next by thread: Re: NSString stringByTrimmingCharactersInSet method doesnt work.
  • Index(es):
    • Date
    • Thread