string str1="Hello_i";
string str2=str1.substring(str1.indexof("_")+1);
str1=str1.substring(0,str1.indexof("_"))+str2.toupper();
string str2=str1.substring(str1.indexof("_")+1);
str1=str1.substring(0,str1.indexof("_"))+str2.toupper();
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();
}
string strlist="Hello_i";
string[] strs=strlist.split('_');
string str=strs[0].tostring()+strs[1].tostring().ToUpper();
int index = s.IndexOf("_"); string t = s.Substring(0, index) + s.Substring(index + 1).ToUpper();
{
/*
字符串的转换函数
例如: 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();
}