【求助】截取字符串问题
5184.091,5167.884,5168.273,5188.482,5158.368,0,0,19155232,27961742922,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2007-08-31,09:58:51 ";
asp.net 中 怎样获取上面字符串第二个和第三个逗号之间的值,就是5168.273这个值。这个值 是实时变动的
------解决方案--------------------indexof
------解决方案--------------------int nPos1 = s.IndexOf( ', ');
int nPos2 = s.IndexOf( ', ', nPos1 + 1);
s = s.Substring(nPos1 + 1, nPos2 - nPos1 - 1);
------解决方案--------------------string sYouGive=你给的字符串;
string[] ss=sYouGive.Split( ', ');
string sYouWant=ss[2].ToString();
------解决方案--------------------int nPos1 = s.IndexOf( ', ');
int nPos2 = s.IndexOf( ', ', nPos1 + 1);
s = s.Substring(nPos1 + 1, nPos2 - nPos1 - 1);
此解正确
------解决方案--------------------indexof
------解决方案--------------------string[] ss=str.Split( ', ');
string temp=ss[2]
------解决方案--------------------char[] c = ', ';
string[] s = str.Split(c);
string temp = s[2];
------解决方案-------------------- IndexOf
Substring
------解决方案--------------------Substring(18,8)
------解决方案-------------------- int nPos1 = s.IndexOf( ', ');
int nPos2 = s.IndexOf( ', ', nPos1 + 1);
s = s.Substring(nPos1 + 1, nPos2 - nPos1 - 1);