I have an issue when testing for letters in texts. There is a ligature in the German language called Eszett, written as “”. It can also be written as “ss”.
Now when searching for that ligature, it finds all texts containing “” and all texts containing “ss”. This is correct when the comparing is done with the German locale, but it also finds all texts containing “ss” when I use a different locale like “en-US”.
[code]Dim search As Text = “”
Dim txt As Text = “Zweitadresse” // Note the “ss” on position 9 to 10
Dim result1 As Integer = txt.IndexOf(search, 0, New xojo.Core.Locale(“de-DE”)) // result1 = 9, which is correct
Dim result2 As Integer = txt.IndexOf(search, 0, New xojo.Core.Locale(“en-US”)) // result2 = 9, should be 0
Dim result3 As Integer = txt.IndexOf(search) // result3 = 9, should be 0[/code]
It could be that Text using Unicode graph clusters is mistaking ss for ß like it would take ü as the same as ¨u. that would then be a disadvantage of the type. Maybe it is a bug.
In the meantime, you should probably consider String Instr. Or Regex.
I tested it with declares into OS X foundation framework and I get the same result. There is also a discussion of this Eszett-issue on CocoaBuilder.
It is an interesting case, because the result makes sense when sorting ("" should be “replaced” by “ss”). But for filtering it is wrong, because you should be able to search for “” without getting all texts containing “ss”. But since even Apple is doing it wrong, I’ll have to find a work-around.