On 7 Oct 2008, at 09:20, cGraham Cox <[EMAIL PROTECTED]> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to