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]));

解决方案 »

  1.   

    string myStr = "RK2004-9-2-006"
    string[] myStrs = myStr.split('-');
    -----------------------------------
    则:myStrs[0]= "RK2004"myStrs[1]= "9"myStrs[2]= "2"myStrs[3]= "006"
      

  2.   

    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]));
      

  3.   

    vbban de wo dao hui
      

  4.   

    那么如果前面应该去掉的字符不确定数量.
    有时两个有时3个,应该怎么办?
    例如
    "RK2004-9-2-006"
    "RKD2004-9-2-006"
      

  5.   

    string Did="RK2004-9-2-006";
    string[] temp=Did.Split('-');string sDate = string.Format("{0}-{1}-{2}",temp[0].Remove(0,2),temp[1],temp[2]);
      

  6.   

    string Did="RK2004-9-2-006";
    string[] temp=Did.Split('-');
      

  7.   

    string Did="RK2004-9-2-006";
    string[] temp=Did.Split('-');
    Response.Write(string.Format("{0}-{1}-{2}",temp[0].Substring(temp[0].Length-4,4),temp[1],temp[2]));这样就不用管前面有几个字符了
      

  8.   

    colderboy那个比较正确,可以采纳