int i = str.indexof("_");
string str2 = str.substring(i+1,1).ToUpper();
str.replace("_"+str2.ToLower(),str2);

解决方案 »

  1.   


    private 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();
    }
      

  2.   

    不好意思
    我说的是一楼的
    二楼的shile,可以实现
      

  3.   

    顺便补充一句
    二楼的引用空间是 System.Text.RegularExpressions
      

  4.   

    2楼没有处理首字母,^o^ 继续蹭点分
    string yourStr = "heelo_ied_tr";
    string destStr = Regex.Replace(yourStr, @"(\b|_)\w",
        new MatchEvaluator(delegate(Match match) { 
            return match.Value.Trim('_').ToUpper(); }));
    MessageBox.Show(destStr);
      

  5.   

    我也来一个,哈哈            string s = "heelo_ied_tr";
                int index = s.IndexOf("_");
                if (index > -1)
                    s = Replace(s, index);
      string Replace(string s, int index)
            {
                s = s.Replace(s.Substring(index + 1, 1), s.Substring(index + 1, 1).ToUpper());
                s = s.Remove(index,1);
                if ((index=s.IndexOf("_")) > -1)
                {
                    s = Replace(s, index);
                }            return s;
            }
      

  6.   


                string aa = "heelo_ied_tr";
                string[] ArrayString = aa.Split('_');
                string Result = "";
                for (int i = 0; i < ArrayString.Length; i++)
                {
                    string temp = ArrayString[i].Substring(0,1).ToUpper();
                    Result +=temp+ArrayString[i].Substring(1);
                }
                textBox1.Text = Result;试试我这个吧,嘿嘿