• 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
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stringByTrimmingCharactersInSet


  • Subject: Re: stringByTrimmingCharactersInSet
  • From: Diggory Laycock <email@hidden>
  • Date: Thu, 19 Sep 2002 13:41:30 +0100

whiteSpaceCharacterSet is a Class method of NSCharacterSet - not a constant.

You should try this:

someString= [Text stringByTrimmingCharactersInSet: [NSCharacter set whitespaceCharacterSet]];

n.b. - note this will 'Trim' - i.e. take spaces from beginning and end - not the middle.

This caught me out the other day:

e.g.
" foo " -> "foo"
" f o o " -> "f o o"


Digs.


On Thursday, September 19, 2002, at 01:10 pm, Claudius Sailer wrote:

Hi,

I am using the following:

[Text stringByTrimmingCharactersInSet:whitespaceCharacterSet]

and the debugger says "WhitespaceCharacterSet undeclared (first use in this function)" Why?

I only want to "trim" the NSString Text!!!


Claudius
_______________________________________________
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.


Diggory Laycock
-----------------------
http://www.diggory.net
_______________________________________________
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.

  • Prev by Date: Re: stringByTrimmingCharactersInSet
  • Next by Date: [newbie] translating mouse location in an NSImageView
  • Previous by thread: Re: stringByTrimmingCharactersInSet
  • Next by thread: [newbie] translating mouse location in an NSImageView
  • Index(es):
    • Date
    • Thread