Hi,
In my apps I use the following function:
Sub SortAccentuatedArray(ByRef Data() As String)
Dim accents As String = "àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ"
Dim correct As String = "aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY"
dim temp() As String
Dim i, j As Integer
Dim uData As Integer = UBound(Data)
Dim str As String
Dim uLen As Integer
Dim Pos As Integer
For i = 0 to uData
str = Data(i)
uLen = Len(str)
For j = 0 to uLen
If asc(str.Mid(j, 1)) > 127 then
Pos = accents.instr(str.Mid(j, 1))
If Pos > 0 then
//Replace the accentuated char.
//Using Replace is faster than using ReplaceAll
str = Replace(str, accents.Mid(Pos, 1), correct.Mid(Pos, 1))
End If
End If
Next
temp.Append str
Next
temp.SortWith(Data)
End Sub
You can test it by adding the function to a Window.
Then add the following code in the Window.open event:
dim a() As String
a = Array("Zoo", "ère", "arbre", "ábaco")
SortAccentuatedArray(a)
MsgBox(Join(a, EndOfLine))
[Edit]: Updated the code to improve performance by 30% on an Array of 89000 entries.
The sort takes ~780ms for the regular Array.Sort function
And takes ~2.800ms for the SortAccentuatedArray function.