sort accent char correctly
Jan Schenkel
janschenkel at yahoo.com
Wed Sep 25 11:48:01 EDT 2002
Hi Sylvain,
You could use the keyword "international"
sort lines of tVariable international
but Yves Coppe reported having problems with it.
Relevant links to the use-revolution archive:
http://lists.runrev.com/pipermail/use-revolution/2002-August/007312.html
http://lists.runrev.com/pipermail/use-revolution/2002-August/007319.html
An alternative sort routine was developed, and here's
the resulting code:
function myInternationalSort sourceVar
put myUpper(sourceVar) into upperVar
put upperVar into sortVar
sort the lines of sortVar
repeat for each line theLine of sortVar
put line (lineOffset(theLine, upperVar)) of \
sourceVar & return after resultVar
end repeat
delete char -1 of resultVar
return resultVar
end myInternationalSort
function myUpper pString
repeat for each char tChar in pString
put myUpperChar(tChar) after tString
end repeat
return tString
end myUpper
function myUpperChar pChar
if toLower(pChar) is in "áàâ" then return "A"
if toLower(pChar) is in "éèê" then return "E"
if toLower(pChar) is in "úùû" then return "U"
-- add some more lines for the other vowels...
if toLower(pChar) is in "ç" then return "C"
-- default is standard toUpper()
return toUpper(pChar)
end myUpperChar
Hope this helped,
Jan Schenkel.
"As we grow older, we grow both wiser and more foolish
at the same time." (De Rochefoucald)
--- Sylvain_Le_Gourriérec
<sylvain.legourrierec at son-video.com> wrote:
> hello,
>
> I know that topic was discussed a few days ago but I
> do not remenber how the problem was solved!
>
>
> In french, we love to use é ù à É À...
>
> But revolution sort 'Canon, Crayon, Câble' instead
> of 'Câble, Canon, Crayon'.
>
>
> How can I quickly obtain this result?
>
>
> thanks
>
>
---------------------------------------------------------------------------------------------------------------------------------------------
> Sylvain Le Gourriérec -- développement --
> son-video-distribution www.son-video.com
>
> ------------- I am working with Windows 2000,
> Revolution 1.1.1, MySQL 3.23 & PHP 4
>
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
More information about the use-livecode
mailing list