1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
function RemoveAccent(const S: string): string;
const
ATC : array[$C0..$DF] of Byte = ($41, $41, $41, $41, $41, $41, $41,
$43, $45, $45, $45, $45, $49, $49,
$49, $49, $44, $4E, $4F, $4F, $4F,
$4F, $4F, $4F, $4F, $55, $55, $55,
$55, $59, $42, $59);
var
pbResult : PByte;
begin
Result := S;
pbResult := PByte(Result);
while pbResult^ <> $0 do begin
if pbResult^ > $7A then
case pbResult^ of
$8A: pbResult^ := $53;
$8E: pbResult^ := $5A;
$9E: pbResult^ := $7A;
$9F: pbResult^ := $59;
$C0..$DF: pbResult^ := ATC[pbResult^];
$E0..$FF: pbResult^ := ATC[pbResult^ xor $20] xor $20;
end;
Inc(pbResult, SizeOf(Char));
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
const
accent : string = 'Essai de ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÌÍÎÏìíîïÙÚÛÜùúûüÿÑñÇç';
begin
ShowMessage(RemoveAccent(accent));
end; |
Partager