Metindeki Türkçe karakterleri en yakın karşılıklarına çevirmek için bu fonksiyon kullanılabilir.

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;

type
TForm1 = class(TForm)
OpenDialog1: TOpenDialog;
Label1: TLabel;
Button1: TButton;
ProgressBar1: TProgressBar;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

function DropTR(inStr: String): String;
var
i: integer;
begin
Form1.ProgressBar1.Max := Length(inStr);
for i := 1  to Length(inStr) do
begin
case inStr[i] of
‘ı’: inStr[i] := ‘i’;
‘ö’: inStr[i] := ‘o’;
‘ü’: inStr[i] := ‘u’;
‘ğ’: inStr[i] := ‘g’;
‘ş’: inStr[i] := ‘s’;
‘ç’: inStr[i] := ‘c’;
‘İ’: inStr[i] := ‘I’;
‘Ö’: inStr[i] := ‘O’;
‘Ü’: inStr[i] := ‘U’;
‘Ğ’: inStr[i] := ‘G’;
‘Ş’: inStr[i] := ‘S’;
‘Ç’: inStr[i] := ‘C’;
end;
Form1.ProgressBar1.Position := i;
if i mod 100 = 0 then
Application.ProcessMessages;
end;

result := inStr;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
List: TStringList;
i: integer;
begin
if OpenDialog1.Execute then
begin
List := TStringList.Create();
List.LoadFromFile(OpenDialog1.FileName);
List.Text := DropTR(List.Text);
List.SaveToFile(OpenDialog1.FileName);
end;
end;

end.

Yazan: Tankado

CEVAP VER

This site uses Akismet to reduce spam. Learn how your comment data is processed.