• 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: Graham Cox <email@hidden>
  • Date: Tue, 7 Oct 2008 16:31:36 +1100


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.

then compare the resulting temporary strings as normal.


hth,

Graham
_______________________________________________

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


References: 
 >comparing Strings. (From: Sandro Noel <email@hidden>)

  • Prev by Date: comparing Strings.
  • Next by Date: Re: comparing Strings.
  • Previous by thread: comparing Strings.
  • Next by thread: Re: comparing Strings.
  • Index(es):
    • Date
    • Thread