string Did="RK2004-9-2-006";
string[] temp=Did.Split('-');
Response.Write(string.Format("{0}-{1}-{2}",temp[0].Remove(0,2),temp[1],temp[2]));
string[] temp=Did.Split('-');
Response.Write(string.Format("{0}-{1}-{2}",temp[0].Remove(0,2),temp[1],temp[2]));
string[] myStrs = myStr.split('-');
-----------------------------------
则:myStrs[0]= "RK2004"myStrs[1]= "9"myStrs[2]= "2"myStrs[3]= "006"
string[] temp=Did.Split('-');
Response.Write(string.Format("{0}-{1}-{2}",temp[0].Remove(0,2),temp[1],temp[2]));
有时两个有时3个,应该怎么办?
例如
"RK2004-9-2-006"
"RKD2004-9-2-006"
string[] temp=Did.Split('-');string sDate = string.Format("{0}-{1}-{2}",temp[0].Remove(0,2),temp[1],temp[2]);
string[] temp=Did.Split('-');
string[] temp=Did.Split('-');
Response.Write(string.Format("{0}-{1}-{2}",temp[0].Substring(temp[0].Length-4,4),temp[1],temp[2]));这样就不用管前面有几个字符了