Page 1 of 1

How to sort array regarding international characters?

Posted: Tue Sep 22, 2009 6:52 am
by mol
Do anybody know, how to sort array regarding international (polish, deutsch) characters?


Best regards, Marek

Re: How to sort array regarding international characters?

Posted: Tue Sep 22, 2009 2:16 pm
by sudip
Hello Marek,

I saw something which may be helpful. I saw this in Yahoo Minigui group.
Hello Sasha,

I don't know if it helps you, but I use a function for creating my own index. I
use it to set the order of plantnames in the way I want it. Lots of plants have
special characters in the name (like ä, é...) and I translate all these
characters in a function. Below is an example. It is very important that if you
replace characters, at the end of the function the length of the indexed value
is as long as at the start of the function.

example:

FUNCTION NameIndex(indexText)

beginlength = LEN(indexText)
indexText= UPPER(omzetnaam)
indexText= STRTRAN(indexText, CHR(0192), 'A') && À
indexText= STRTRAN(indexText, CHR(0193), 'A') && Á
indexText= STRTRAN(indexText, CHR(0194), 'A') && Â
indexText= STRTRAN(indexText, CHR(0195), 'A') && Ã
indexText= STRTRAN(indexText, CHR(0196), 'A') && Ä
indexText= STRTRAN(indexText, CHR(0197), 'A') && Å
indexText= STRTRAN(indexText, CHR(0198), 'AE') && Æ
indexText= STRTRAN(indexText, CHR(0199), 'C') && Ç
indexText= STRTRAN(indexText, CHR(0200), 'E') && È
indexText= STRTRAN(indexText, CHR(0201), 'E') && É
indexText= STRTRAN(indexText, CHR(0202), 'E') && Ê
.
.
.
.
endlength := LEN(indexText)
spaces := beginlength - endlength
indexText := indexText+ SPACE(spaces )

RETURN indexText

When you index a file do it this way:

INDEX ON NameIndex(cField)

Rene
I don't know whether it is legal or not to quote this in this manner. If I did any wrong, please warn me :)

With best regards.

Sudip

Re: How to sort array regarding international characters?

Posted: Tue Sep 22, 2009 5:30 pm
by mol
Yes, I think, it will be very useful!

Many thanks, Sudip!