我现在要取 "/ "后面的 "54345 "
string s= "1234567/54345 ";
string[] arr = s.Split(new char[]{ '/ '});// 返回字符串数组{ "12345567 ", "54345 "}
要取54345只需调用arr[1]就可以了
string s= "1234567/54345 ";
string substring=s.SubString(s.LastIndexOf( "/ ")+1);
Split函数返回的是一个由分割符(比如/)分割的字符串数组,
例如:
输入 分割符 返回值
"42, 12, 19 " new Char[] { ', ', ' '} { "42 ", " ", "12 ", " ", "19 "}
"42..12..19 " new Char[] { '. '} { "42 ", " ", "12 ", " ", "19 "}
"Banana " new Char[] { '. '} { "Banana "}
"Darb\nSmarba " new Char[] {} { "Darb ", "Smarba "}
"Darb\nSmarba " null { "Darb ", "Smarba "}
"12/123/456 " new Char[] { '/ '} { "12 ", "123 ", "456 "}
到Msdn上去查一下吧System.String类