您的位置:首页 > 其它

如何让首字母变成大小写

2013-04-10 00:05 190 查看
using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

// 吴新强于2013年4月10日 桂电 2507

namespace ReplaceWord

{

    public partial class Frm_Main : Form

    {

        public Frm_Main()

        {

            InitializeComponent();

        }

        private void Frm_Main_Load(object sender, EventArgs e)

        {

        }

        /// <summary>

        /// 首字母转换成大写

        /// </summary>

        /// <param name="sender"></param>

        /// <param name="e"></param>

        private void butup_Click(object sender, EventArgs e)

        {

            string str1 = textBox1.Text.Substring(0, 1);

            string str2 = textBox1.Text.Substring(1, textBox1.Text.Length - 1);

            label3.Text = str1.ToUpper() + str2;

        }

        /// <summary>

        /// 首字母转换成小

        /// </summary>

        /// <param name="sender"></param>

        /// <param name="e"></param>

        private void butlow_Click(object sender, EventArgs e)

        {

            string str1 = textBox1.Text.Substring(0, 1);

            string str2 = textBox1.Text.Substring(1, textBox1.Text.Length - 1);

            label3.Text = str1.ToLower() + str2;

        }

    }

}

实验结果:



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: