Anoop Vaidya
Anoop Vaidya

Reputation: 46543

Unable to compare some foreign language using compare:

I am dealing with some foreign language filenames such as 내가 해결할 수없는 생각.docx.

When I compare the filenames with NSString's compare: it returns False even for the same stored filename. Strange part is that it returns True with caseInsensitiveCompare:.

I have tested by passing English filenames, it works good compare:, showing the filenames are not capitalized by any chance.

I can compare with this not the best of way, but there are many cases where NSPredicate also fails to compare the two strings.

My question is how to compare these non-english text?

Is there any other better way to compare, or do I need to use a loop and use caseInsensitiveCompare:?

Upvotes: 2

Views: 75

Answers (1)

Shlok Datye
Shlok Datye

Reputation: 91

comare: doesn’t return “True” or “False” (or YES or NO). It returns a value of type NSComparisonResult, which can be NSOrderedAscending, NSOrderedSame, or NSOrderedDescending. Is there maybe some confusion here having to do with the corresponding integer values of these three values (-1, 0, and 1, respectively)?

Upvotes: 1

Related Questions