zoukankan      html  css  js  c++  java
  • C# 所有单词首字母改为大写的方法

    首先要添加引用Microsoft.VisualBasic,还要添加命名空间:using Microsoft.VisualBasic; 下面是代码:

    using System;
    using System.Windows.Forms;
    using Microsoft.VisualBasic;
    

      

            private void button1_Click(object sender, EventArgs e)
            {
                textBox2.Text = ConvertToUpper(textBox1.Text.Trim());
            }
            /// <summary>
            /// 返回所有单词首字改为大写后的结果
            /// </summary>
            /// <param name="str">普通字符串</param>
            /// <returns>所有单词更改为首字母大写</returns>
            public string ConvertToUpper(string str)
            {
                string S = Strings.StrConv(str, VbStrConv.ProperCase, System.Globalization.CultureInfo.CurrentCulture.LCID);
                return S;
            private void button1_Click(object sender, EventArgs e)
            {
                textBox2.Text = ConvertToUpper(textBox1.Text.Trim());
            }
            /// <summary>
            /// 返回所有单词首字改为大写后的结果
            /// </summary>
            /// <param name="str">普通字符串</param>
            /// <returns>所有单词更改为首字母大写</returns>
            public string ConvertToUpper(string str)
            {
                string S = Strings.StrConv(str, VbStrConv.ProperCase, System.Globalization.CultureInfo.CurrentCulture.LCID);
                return S;
            }
            }
    

      

  • 相关阅读:
    工业设计之美
    狠挖用户需求与用户分析——赫志中
    《必然》
    在一周内学会使用 AUTO CAD
    可控硅调光知识总结
    PADS Logic Decal、Layout Decal绘制
    BUCK-BOOST反激变压器设计
    RCC BUCK-BOOST变压器设计
    产品生产
    由《旧制度与大革命》提取的5个感触
  • 原文地址:https://www.cnblogs.com/wzihan/p/14868592.html
Copyright © 2011-2022 走看看