string str1="Hello_i";
string str2=str1.substring(str1.indexof("_")+1);
str1=str1.substring(0,str1.indexof("_"))+str2.toupper();

解决方案 »

  1.   


                string s = "Hello_IIIkai";
                int index = s.IndexOf("_");
                if (index > -1)
                {                string temp = s.Substring(index + 1);                s = s.Remove(index, s.Length - index);
                    s = s + temp.ToUpper();
                }
      

  2.   


    string strlist="Hello_i";
    string[] strs=strlist.split('_');
    string str=strs[0].tostring()+strs[1].tostring().ToUpper();
      

  3.   

                string s = "Hello_IIIkai";
                int index = s.IndexOf("_");            string t = s.Substring(0, index) + s.Substring(index + 1).ToUpper();
      

  4.   

    那如果有两个下划线 比如 heelo_ied_tr怎么变成heelo_Ied_Tr
      

  5.   

    try thisprivate void button1_Click(object sender, EventArgs e)
    {
            /*
            字符串的转换函数  
             例如: Hello_i 变成 HelloI 
            要求遇到下划线去掉 且下划线后面如果是小写变成大写需要
             */
            string yourStr = "Hello_i";
            string destStr = Regex.Replace(yourStr, "_[a-zA-Z]", MyMatchEvaluator);
            MessageBox.Show(destStr);
    }public string MyMatchEvaluator(Match match)
    {
            return match.Value.Substring(1).ToUpper();
    }