简体   繁体   English

如何在C#中将RichTextBox转换为大写?

[英]How to convert a RichTextBox to upper case in C#?

I try: 我尝试:

private void button1_Click(object sender, EventArgs e)
{
    richTextBox1.SelectAll();
    string[] textArray = richTextBox1.SelectedText.Split(new char[] { '\n', '\t' });
    foreach (string strText in textArray)
    {
        if (!string.IsNullOrEmpty(strText) && strText != "rtf")
        richTextBox1.Rtf = richTextBox1.Rtf.Replace(strText, strText.ToUpper());
    }
}

and, in my windows form: 并且,以我的Windows形式:

在此处输入图片说明

when i click button 1: 当我单击按钮1时:

在此处输入图片说明

It do not work with "tôi tên là" Please help me. 它不适用于“tôitênlà”,请帮助我。 Thank! 谢谢!

You are probably not utilising culture info 您可能没有利用文化信息

    "tôi tên là".ToUpper(CultureInfo.GetCultureInfo("fr-FR"));
  // put your culture instead of fr-FR inside

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM