Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 12-09-2009, 11:05 AM   #9 (permalink)
keyneosoft
Registered Member
 
Join Date: Dec 2009
Posts: 4
keyneosoft is on a distinguished road
Default

Quote:
Originally Posted by Mr Jack View Post
You're French, no? Are you comparing strings that contain accented characters? These may not be correctly compared unless you use localizedCaseInsensitiveCompare instead.

Otherwise, could you post your code, and the specific strings that you're having problems with?
Yes I'm french, but I think that doesn't come from this.
I cannot post the specific strings because they come from a csv of french towns that I parse.
The strings are composed an address (including the name of the city) : for instance 24 RUE DE LA LIBERTE LILLE and so on.
Every string is in uppercase, to avoid the accented characters case.

On the app, I want to find the objects that correspond to a search I'd type in the searchBar.

My test is the following one :

Quote:
for (POI *item in allPOIs) {
int index = 0;
if([searchBar.text isEqualToString:item.title] || [searchBar.text isEqualToString:item.subtitle]
|| [item.title hasPrefix:searchBar.text] || [item.subtitle hasPrefix:searchBar.text]
|| [item.title hasSuffix:searchBar.text] || [item.subtitle hasSuffix:searchBar.text]
|| ([item.title caseInsensitiveCompare:searchBar.text]==NSOrderedSame))
{
[searchTempPOIs addObject:item];
}
index++;
}
where searchTempPOIs is an array of POI.
Do you see where is my mistake ?
Thanks for your answers anyway
keyneosoft is offline   Reply With Quote
 

» Advertisements
» Online Users: 821
24 members and 797 guests
ADY, Agenor, baja_yu, cgokey, Creativ, dansparrow, Duncan C, fkmtc, ilmman, imac74, iram901, kosicki123, latoncefrank, maggyparker, muchless, nestochi, petrsigut, Promo Dispenser, raidu, SillyHoney, stanny, ubaid, xltke, _MAK88_
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,387
Threads: 94,003
Posts: 402,461
Top Poster: BrianSlick (7,978)
Welcome to our newest member, latoncefrank
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:41 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.