Re: Small feature request for future EU versions
- Posted by "Igor Kachan" <kinz at peterlink.ru> Oct 25, 2004
- 649 views
Hi, Dear EU users! Me wrote: [snip] > Me did not provide the universal function for any alphabet, > but a *way* to make the concrete function for concrete alphabet. [snip] > The task is not very difficult if you do know your native alphabet, > be sure, dear End Users. Let us try to use that way to make the concrete (i.e. specific, only this one, not any other) function for concrete well known alphabet -- pure Latin -- alphabet_la, just for example.
sequence alphabet_la alphabet_la="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" global function case_LA(integer c, object x) -- case_LA -- to not confuse with the existing case_la() function -- convert Latin atom or sequence to upper or to lower case integer n sequence A, a if c then A=alphabet_la[1 ..26] a=alphabet_la[27..52] else a=alphabet_la[1 ..26] A=alphabet_la[27..52] end if n = 0 if atom(x) then n=find(x,a) if n then return A[n] else return n end if else for i=1 to length(x) do n=find(x[i],a) if n then x[i] = A[n] end if end for end if return x end function -- case_LA() puts(1, alphabet_la & '\n') puts(1, case_LA(1, alphabet_la) & '\n') puts(1, case_LA(0, alphabet_la) & '\n')
Just replace the alphabet_la sequence with your native alphabet and you will have concrete function for your native language and for your current code page. If you see your alphabet correctly in your editor, all right. Do not forget, on DOS and Windows may be different results. Say, sequence alphabet_mj alphabet_mj = "......place here The Great Mumbo Jumbo Alphabet....." global function case_mj(integer c, object x) And so on. Do not forget: A=alphabet_mj[1 .. not 26, but needed number] a=alphabet_mj[not 27, but needed number .. not 52, but needed number] -- Just first and second half. ... is easy peasy, NO? -- by Pete Lomax But I just now found one old bug in my case_ru() function. Thanks for your questions! Regards, Igor Kachan kinz at peterlink.ru