8 个解决方案
#1
SubString()
#2
int i=string.index('-');
string=string.substring(i);
string=string.substring(i);
#3
string str = "aaaaaaa_bbbbbbb";
int index = str.IndexOf("_");
int length = str.Length;
if(index + 1 >= length)
{
//最后一个字符是"_",不能截取
return;
}
string resultStr = str.SubString(index + 1, length - index - 1);
int index = str.IndexOf("_");
int length = str.Length;
if(index + 1 >= length)
{
//最后一个字符是"_",不能截取
return;
}
string resultStr = str.SubString(index + 1, length - index - 1);
#4
string str = "aaaaa_bbbbb";
string []strs = str.split('_');
if(strs.length > 1)
messagebox.show(strs[1]);
string []strs = str.split('_');
if(strs.length > 1)
messagebox.show(strs[1]);
#5
colaxu(飞翔)得不错
#6
都说了,来晚了
#7
str="aaaaaaa_bbbbbbb"
str2=str.Split('_')[1];
str2=str.Split('_')[1];
#8
#1
SubString()
#2
int i=string.index('-');
string=string.substring(i);
string=string.substring(i);
#3
string str = "aaaaaaa_bbbbbbb";
int index = str.IndexOf("_");
int length = str.Length;
if(index + 1 >= length)
{
//最后一个字符是"_",不能截取
return;
}
string resultStr = str.SubString(index + 1, length - index - 1);
int index = str.IndexOf("_");
int length = str.Length;
if(index + 1 >= length)
{
//最后一个字符是"_",不能截取
return;
}
string resultStr = str.SubString(index + 1, length - index - 1);
#4
string str = "aaaaa_bbbbb";
string []strs = str.split('_');
if(strs.length > 1)
messagebox.show(strs[1]);
string []strs = str.split('_');
if(strs.length > 1)
messagebox.show(strs[1]);
#5
colaxu(飞翔)得不错
#6
都说了,来晚了
#7
str="aaaaaaa_bbbbbbb"
str2=str.Split('_')[1];
str2=str.Split('_')[1];