[Lazarus] Case error with cirilyc

theo xpde at theo.ch
Thu Sep 17 21:38:41 CEST 2009


You might try utf8scanner http://wiki.lazarus.freepascal.org/Theodp
This should do what you need:

procedure TForm1.Button1Click(Sender: TObject);
var s :TUTF8Scanner;
begin
s := TUTF8Scanner.Create(Memo1.text);
s.FindChars :='абвгдabvgd';
//Memo1.text:=s.GenerateCaseStatement(); //Writes the case block for you
repeat
case s.FindIndex(s.Next) of
{а} 0: s.Replace('a');
{б} 1: s.Replace('b');
{в} 2: s.Replace('v');
{г} 3: s.Replace('g');
{д} 4: s.Replace('d');
{a} 5: s.Replace('a');
{b} 6: s.Replace('b');
{v} 7: s.Replace('v');
{g} 8: s.Replace('g');
{d} 9: s.Replace('d');
end;
until s.Done;
Memo2.Text := s.UTF8String;
s.free;
end;





More information about the Lazarus mailing list