如何将土耳其语字符转换为拉丁字符 [英] how to convert Turkish character to Latin charackter

查看:66
本文介绍了如何将土耳其语字符转换为拉丁字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

将土耳其语字符转换为拉丁字符时...我遇到问题..当我在TextChanged事件中执行此代码时,textBox上的光标移到textBox的第一行
我该如何解决这个问题?像这张照片 http://img429.yukle.tc/images/9089first.png [

Hi guys ,

While converting Turkish char to Latin char...I get a problem..When i do this code in TextChanged event , the cursor on the textBox goes the first line of textBox
How can i overwhelm this problem ? like this picture http://img429.yukle.tc/images/9089first.png[^]


Thanks in advance for your help..



private void txtMesaj_TextChanged_3(object sender, EventArgs e)
      {

              string yazi = txtMesaj.Text;
              yazi = yazi.Replace("ü", "u"); //yazi= yazi.Replace("eski değer","yeni değer") anlamına gelir.Yani yazi değişkenindeki eski değer ile yeni değiştirip tekrardan yazi değişkenime yeni değerimi atıyorum
              yazi = yazi.Replace("ı", "i");
              yazi = yazi.Replace("ö", "o");
              yazi = yazi.Replace("ü", "u");
              yazi = yazi.Replace("ş", "s");
              yazi = yazi.Replace("ğ", "g");
              yazi = yazi.Replace("ç", "c");
              yazi = yazi.Replace("Ü", "U");
              yazi = yazi.Replace("İ", "I");
              yazi = yazi.Replace("Ö", "O");
              yazi = yazi.Replace("Ü", "U");
              yazi = yazi.Replace("Ş", "S");
              yazi = yazi.Replace("Ğ", "G");
              yazi = yazi.Replace("Ç", "C");

              txtMesaj.Text = yazi;
          }

推荐答案

将光标位置保存在第1个位置(-> SelectionStart),并在所有替换后返回.
Save the cursor position at 1st (-> SelectionStart) and set back after all replacements.

int cursorPos = txtMesaj.SelectionStart;

// do something

txtMesaj.SelectionStart = cursorPos; 


textBox1.SelectionStart = textBox1.TextLength;


这篇关于如何将土耳其语字符转换为拉丁字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆