How can I regex case insensitive in unicode string?

Lets say I want to search for the Greek work Καλημέρα which means good morning How do I search for ΚΑΛΗΜΕΡΑ or καλημέρα or even κΑΛΗΜερα

Answers


In this example using NSCaseInsensitiveSearch items 1 & 3 match as do items 2 & 4:

NSString *morningList = @" Καλημέρα, ΚΑΛΗΜΕΡΑ, καλημέρα, κΑΛΗΜερα";
NSArray *morningTests = [NSArray arrayWithObjects:@"Καλημέρα", @"ΚΑΛΗΜΕΡΑ", @"καλημέρα", @"κΑΛΗΜερα", nil];

for (NSString *morning in morningTests) {
    NSRange range = [morningList rangeOfString:morning options:NSCaseInsensitiveSearch];
    NSLog(@"location of '%@': %lu", morning, range.location);
}

NSLog output:

location of 'Καλημέρα': 1
location of 'ΚΑΛΗΜΕΡΑ': 11
location of 'καλημέρα': 1
location of 'κΑΛΗΜερα': 11

Not exactly what was asked but perhaps helpful.


Need Your Help

How to add some prebuild steps to jenkins?

continuous-integration hudson jenkins

I am a Jenkins newbie and need a little hand holding because we only maintain parts of our app in SVN. I have basic Jenkins install setup.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.