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

Re: comparing Strings.


  • Subject: Re: comparing Strings.
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Tue, 7 Oct 2008 10:46:12 +0200


On 7 Oct 2008, at 09:20, cGraham Cox <email@hidden> wrote:

On 7 Oct 2008, at 4:22 pm, Sandro Noel wrote:

i'm having a problem comparing some type of strings, for example the
one giving me a problem right now.
is let's say in my database i have 4 version of the same string .

"sandro's computer"
"sandro's_computer"
"sandros computer"
"sandros_computer"

I would like them to compare as being equal,
is there a way I can mingle with the comparing routine
to ask it to ignore some characters in the comparison?


First strip out the characters to be ignored:

NSString* tempString = [myString stringByTrimmingCharactersInSet:
[NSCharacterSet characterSetWithCharactersInString:@"'_ "]];

returns "sandroscomputer" given any of the above.

Are you quite sure?
The Tiger documentation says: "Returns a new string made by removing from both ends of the receiver characters contained in a given character set."


If this is still true, then the internal apostrophs would not get removed.

But maybe I am misunderstanding the documentation.
DId not actually test this.

Kind regards,

Gerriet.

_______________________________________________

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: comparing Strings.
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Getting NSTimer to work after an NSThread completes?
  • Next by Date: CoreData: Fetching object with maximum of property
  • Previous by thread: Re: comparing Strings.
  • Next by thread: Re: comparing Strings.
  • Index(es):
    • Date
    • Thread