Delphi Can
EditText'e sadece ingilizce karakter girişi yapılması / convert edilmesi - Baskı Önizleme

+- Delphi Can (https://www.delphican.com)
+-- Forum: Delphi (https://www.delphican.com/forumdisplay.php?fid=3)
+--- Forum: Genel Programlama (https://www.delphican.com/forumdisplay.php?fid=6)
+--- Konu Başlığı: EditText'e sadece ingilizce karakter girişi yapılması / convert edilmesi (/showthread.php?tid=4789)



EditText'e sadece ingilizce karakter girişi yapılması / convert edilmesi - 41linea41 - 02-05-2020

Merhaba

Edit Text içerisine sadece ingilizce karakter girişi yapılması türkçe karakterleri değiştirmesi için şu fonksiyonu kullanıyorum ama küçük ı karakterini i olarak değiştirmiyor.

fonksiyon:
function ChEng (ch : char) : char;
begin
if (ch = 'Ğ') or (ch = 'ğ') then begin result:='G';exit;end;
if (ch = 'Ü') or (ch = 'ü') then begin result:='U';exit;end;
if (ch = 'Ş') or (ch = 'ş') then begin result:='S';exit;end;
if (ch = 'İ') or (ch = 'ı') then begin result:='I';exit;end;
if (ch = 'Ö') or (ch = 'ö') then begin result:='O';exit;end;
if (ch = 'Ç') or (ch = 'ç') then begin result:='C';exit;end;
if (ch = 'i') then begin result:='i';exit;end;
if (ch = 'ı') then begin result:='i';exit;end;
if (ch = 'I') then begin result:='i';exit;end;
result:=ch;
end;

onKeyUP içerisinde şu şekilde kullanıyorum. Burada hata nerede olabilir sadece küçük ı karakterinde sorun var.

tx:=copy(edtAdminTel.Text,0,length(edtAdminTel.Text)-1);
edtAdminTel.text:=tx+cheng(keyCHAR);



Cvp: EditText'e sadece ingilizce karakter girişi yapılması / convert edilmesi - Halil Han BADEM - 02-05-2020

(02-05-2020, Saat: 12:31)41linea41 Adlı Kullanıcıdan Alıntı: Merhaba

Edit Text içerisine sadece ingilizce karakter girişi yapılması türkçe karakterleri değiştirmesi için şu fonksiyonu kullanıyorum ama küçük ı karakterini i olarak değiştirmiyor.

fonksiyon:
function ChEng (ch : char) : char;
begin
if (ch = 'Ğ') or (ch = 'ğ') then begin result:='G';exit;end;
if (ch = 'Ü') or (ch = 'ü') then begin result:='U';exit;end;
if (ch = 'Ş') or (ch = 'ş') then begin result:='S';exit;end;
if (ch = 'İ') or (ch = 'ı') then begin result:='I';exit;end;
if (ch = 'Ö') or (ch = 'ö') then begin result:='O';exit;end;
if (ch = 'Ç') or (ch = 'ç') then begin result:='C';exit;end;
if (ch = 'i') then begin result:='i';exit;end;
if (ch = 'ı') then begin result:='i';exit;end;
if (ch = 'I') then begin result:='i';exit;end;
result:=ch;
end;

onKeyUP içerisinde şu şekilde kullanıyorum. Burada hata nerede olabilir sadece küçük ı karakterinde sorun var.

tx:=copy(edtAdminTel.Text,0,length(edtAdminTel.Text)-1);
edtAdminTel.text:=tx+cheng(keyCHAR);
Merhaba,
kullanıcıyı veriyi girdikten sonra eğer bir button ile veri gidecek ise bir yere StringReplace fonksiyonu ile değiştirmenizi öneririm.
İyi çalışmalar.


Cvp: EditText'e sadece ingilizce karakter girişi yapılması / convert edilmesi - meko - 02-05-2020

function ChEng (ch : char) : char;
begin
if (ch = 'Ğ') or (ch = 'ğ') then begin result:='G';exit;end;
if (ch = 'Ü') or (ch = 'ü') then begin result:='U';exit;end;
if (ch = 'Ş') or (ch = 'ş') then begin result:='S';exit;end;
a) if (ch = 'İ') or (ch = 'ı') then begin result:='I';exit;end;
if (ch = 'Ö') or (ch = 'ö') then begin result:='O';exit;end;
if (ch = 'Ç') or (ch = 'ç') then begin result:='C';exit;end;
if (ch = 'i') then begin result:='i';exit;end;
b) if (ch = 'ı') then begin result:='i';exit;end;
if (ch = 'I') then begin result:='i';exit;end;
result:=ch;
end;

a satırından dolayı b satırına gelmez

Not : if yerine case kullansan daha verimli olabilir


Cvp: EditText'e sadece ingilizce karakter girişi yapılması / convert edilmesi - 41linea41 - 02-05-2020

(02-05-2020, Saat: 13:01)Halil Han Badem Adlı Kullanıcıdan Alıntı:
(02-05-2020, Saat: 12:31)41linea41 Adlı Kullanıcıdan Alıntı: Merhaba

Edit Text içerisine sadece ingilizce karakter girişi yapılması türkçe karakterleri değiştirmesi için şu fonksiyonu kullanıyorum ama küçük ı karakterini i olarak değiştirmiyor.

fonksiyon:
function ChEng (ch : char) : char;
begin
if (ch = 'Ğ') or (ch = 'ğ') then begin result:='G';exit;end;
if (ch = 'Ü') or (ch = 'ü') then begin result:='U';exit;end;
if (ch = 'Ş') or (ch = 'ş') then begin result:='S';exit;end;
if (ch = 'İ') or (ch = 'ı') then begin result:='I';exit;end;
if (ch = 'Ö') or (ch = 'ö') then begin result:='O';exit;end;
if (ch = 'Ç') or (ch = 'ç') then begin result:='C';exit;end;
if (ch = 'i') then begin result:='i';exit;end;
if (ch = 'ı') then begin result:='i';exit;end;
if (ch = 'I') then begin result:='i';exit;end;
result:=ch;
end;

onKeyUP içerisinde şu şekilde kullanıyorum. Burada hata nerede olabilir sadece küçük ı karakterinde sorun var.

tx:=copy(edtAdminTel.Text,0,length(edtAdminTel.Text)-1);
edtAdminTel.text:=tx+cheng(keyCHAR);
Merhaba,
kullanıcıyı veriyi girdikten sonra eğer bir button ile veri gidecek ise bir yere StringReplace fonksiyonu ile değiştirmenizi öneririm.
İyi çalışmalar.
Butona bastığım da yaparsam kullanıcı adı ve şifresinin yanlış kaydedilmesine sebep olur.
Kullanıcı kayıt öncesi görmeli.

(02-05-2020, Saat: 13:44)meko Adlı Kullanıcıdan Alıntı:
function ChEng (ch : char) : char;
begin
if (ch = 'Ğ') or (ch = 'ğ') then begin result:='G';exit;end;
if (ch = 'Ü') or (ch = 'ü') then begin result:='U';exit;end;
if (ch = 'Ş') or (ch = 'ş') then begin result:='S';exit;end;
a) if (ch = 'İ') or (ch = 'ı') then begin result:='I';exit;end;
if (ch = 'Ö') or (ch = 'ö') then begin result:='O';exit;end;
if (ch = 'Ç') or (ch = 'ç') then begin result:='C';exit;end;
if (ch = 'i') then begin result:='i';exit;end;
b) if (ch = 'ı') then begin result:='i';exit;end;
if (ch = 'I') then begin result:='i';exit;end;
result:=ch;
end;

a satırından dolayı b satırına gelmez

Not : if yerine case kullansan daha verimli olabilir

Kod alıntı olduğundan gözümden kaçan kısım buymuş.