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

Re: finding substring


  • Subject: Re: finding substring
  • From: Aki Inoue <email@hidden>
  • Date: Fri, 31 Mar 2006 17:42:27 -0800

Chuck,

1. Is this a good assumption?
It is not universal. For majority of scripts, accents are essential that stripping them changes the meaning.

2. What is the best way to find a sub-string and ignore diacritical marks?
You could strip them by using -[NSString decomposedStringWithCanonicalMapping] and +[NSCharacterSet nonBaseCharacterSet].

I have a plan to add diactric-insensitive flag in a future release.

Aki


Hello,

I'm assuming that when a user is trying to search for "São Paulo" in my program that they might use "sa" as a search string.

1. Is this a good assumption?
2. What is the best way to find a sub-string and ignore diacritical marks?


I'm currently using this code which does not ignore diacritical marks:
 NSString *searchStr = @"sa";
 NSString *placeName = @"São Paulo";
 NSRange nameRange = [placeName rangeOfString:searchStr
			options:NSCaseInsensitiveSearch];
 if (nameRange.location != NSNotFound)
	NSLog(@"found string!");

Thanks,
Chuck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: finding substring
      • From: Chuck Soper <email@hidden>
    • Re: finding substring
      • From: Ondra Cada <email@hidden>
References: 
 >finding substring (From: Chuck Soper <email@hidden>)

  • Prev by Date: finding substring
  • Next by Date: Re: finding substring
  • Previous by thread: finding substring
  • Next by thread: Re: finding substring
  • Index(es):
    • Date
    • Thread