20100908;085335;0.413;0.412;0.412;0.411;0.410;0.410;0.409;0.408;0.408;0.407;0.407;0.406;0.405;0.405;0.404;0.403;0.402;0.402;0.401;0.400;0.400;0.399;0.398;0.397;0.397;0.396;0.396;0.395;0.394;0.394;0.393;0.393;0.392;0.392;0.391;0.391;0.391;0.390;0.390;0.390;0.389;0.389;0.388;0.388;0.388;0.387;0.387;0.387;0.387;0.387;0.387;0.387;0.388;0.388;0.389;0.389;0.391;0.392;0.393;0.394;0.395;0.396;0.397;0.398;0.399;0.399;0.400;0.400;0.401;0.402;0.402;0.402;0.402;0.402;0.402;0.401;0.401;0.400;0.400;0.399;0.398;0.397;0.397;0.396;0.395;0.395;0.394;0.394;0.393;0.393;0.392;0.392;0.392;0.391有这么条csv数据,我想到得到的结果是20100908085335 我要怎么分割才能得到, 最好给个源码.
谢谢大家了.
谢谢大家了.
a=split(";")
string b=a[0] 20100908
string c=a[1] 085335
string d=b+c
string s = "20100908;085335;0.413;0.412;0.412;0.411;0.410;0.410;0.409;0.408;0.408;0.407;0.407;0.406;0.405;0.405;0.404;0.403;0.402;0.402;0.401;0.400;0.400;0.399;0.398;0.397;0.397;0.396;0.396;0.395;0.394;0.394;0.393;0.393;0.392;0.392;0.391;0.391;0.391;0.390;0.390;0.390;0.389;0.389;0.388;0.388;0.388;0.387;0.387;0.387;0.387;0.387;0.387;0.387;0.388;0.388;0.389;0.389;0.391;0.392;0.393;0.394;0.395;0.396;0.397;0.398;0.399;0.399;0.400;0.400;0.401;0.402;0.402;0.402;0.402;0.402;0.402;0.401;0.401;0.400;0.400;0.399;0.398;0.397;0.397;0.396;0.395;0.395;0.394;0.394;0.393;0.393;0.392;0.392;0.392;0.391";
string s3= ((from s1 in s.Split(';')
where s1.Length > 5
select s1).Aggregate((a, b) => a + b)).ToString();//用linq实现较简单
Match m = Regex.Match(s, @"\d+");
string result = m.Value + m.NextMatch().Value;result 就是你要的结果
string s = "20100908;085335;0.413;0.412;0.412;0.411;0.410;0.410;0.409;0.408;0.408;0.407;0.407;0.406;0.405;0.405;0.404;0.403;0.402;0.402;0.401;0.400;0.400;0.399;0.398;0.397;0.397;0.396;0.396;0.395;0.394;0.394;0.393;0.393;0.392;0.392;0.391;0.391;0.391;0.390;0.390;0.390;0.389;0.389;0.388;0.388;0.388;0.387;0.387;0.387;0.387;0.387;0.387;0.387;0.388;0.388;0.389;0.389;0.391;0.392;0.393;0.394;0.395;0.396;0.397;0.398;0.399;0.399;0.400;0.400;0.401;0.402;0.402;0.402;0.402;0.402;0.402;0.401;0.401;0.400;0.400;0.399;0.398;0.397;0.397;0.396;0.395;0.395;0.394;0.394;0.393;0.393;0.392;0.392;0.392;0.391";
string s3= ((from s1 in s.Split(new char[]{';','.'})
where s1.Length > 3
select s1).Aggregate((a, b) => a + b)).ToString(); //后来又想了一下,觉得这样写更好点
result=s.Substring(0,8)+s.Substring(9,6);
string[] s1 = s.Split(';');
string s3="";
foreach(string s2 in s1)
{
if (s2.IndexOf('.') == -1)
{
s3 += s2;
}
}