INPUT DATA: pv1[7] 数组中的值比如说是test8^test8^test8^test8^
OUTPUT DATA: pv1[7]数组中的值是^test8^test8^test8^string[] pv1_7temp = pv1[7].Split('^');
pv1_7temp[0] = "";
string str_temp = "";foreach (string str in pv1_7temp)
   {
    str_temp += str + "^";
    pv1[7] = str_temp;
   }输出的结果总是在最后一位多出一个^ = ^test8^test8^test8^^.
请教各位有什么办法只将第一位字符remove,其它的值不变。
Thanks,

解决方案 »

  1.   

    test8^test8^test8^test8^
    变成
    test8^test8^test8^  ?
      

  2.   


    void Main()
    {
    string a="test8^test9^test10^test11^";
     a=string.Join("^",a.Split('^').Skip(1).ToArray());
    Console.WriteLine(a.TrimEnd('^')); //test9^test10^test11
    }
      

  3.   

    void Main()
    {
    string a="test8^test9^test10^test11^";
     a=string.Join("^",a.Split('^').Skip(1).ToArray());
    Console.WriteLine(a);  //如果想保留最后一个 ^ 
    //test9^test10^test11^
    }
      

  4.   


    void Main()
    {
    string a="test8^test9^test10^test11^";
    Console.WriteLine(a.Substring(a.IndexOf('^')+1));   
    //test9^test10^test11^
    }
      

  5.   

    只是要去掉字符串的第一个字符吗?哪用得着这么复杂啊。string str = "abcd";
    str = str.SubString(1);
      

  6.   

    string str="^test8^test9^test10^test11^";
    str= str.Substring(1);
      

  7.   

    string tempStr="^test8^test8^test8^^";
    tempStr=tempStr.split(0,tempStr.length-1);//去除最后一位
      

  8.   

    a.Substring(0, a.Length - 1)  这个就是取a的从第一位到倒数第二位之前的
      

  9.   

    应该是
    string tempStr="^test8^test8^test8^^";
    tempStr=tempStr.Substring(0,tempStr.length-1);//去除最后一位
      

  10.   


    thanks, 不过前面少了一个hex ^
    我结合你的substring用法fixed.
      

  11.   


    it will literally remove the first letter, but in my case I need to remove "test" so i guess we will need tempary array here to store all the letters then remove the first value in that array, add the '^' back to the array afterwards and use substring to output the data. Sorry for the confustion cuz I didn't make the statement very clear. But, still thanks for your thought. I am still seeking alternative to make it simple but... still @ learning curve. any input would be greatly appreciated.Thx,
      

  12.   


    结合Linq一行搞定:str = "^" + string.Join("^", str.Split('^').Skip(1).ToArray())
      

  13.   

    Thank you all for your input. I think I got it.