日期:2008-11-30  浏览次数:20429 次


  private void CutStringToArray(ref string[,] StrArray,string StrWillCut,int NoUseNumber,int MainNum,int SubNum,string Symbol)//切开一个字符串放到数组里面,StrArray是你要放字符串的数组,StrWillCut是你要切得字符串,NoUseNumber,MainNum和SubNum可以都为0是每个小字符串前几位是不要的,Symbol是你的字符串分隔符。
  {
   string TemStrWillCut;
   string TemStrArray;
   int x;int y;int lenStr;

   TemStrWillCut = StrWillCut + "/";

   for(int j=0;j<StrWillCut.Length ;j++)
   {
    if(TemStrWillCut.Length <3)
    {
     break;
    }
    lenStr=TemStrWillCut.Length ;
    for(int i=0;i< lenStr ;i++)//Cut string
    {
     if(TemStrWillCut.Substring (i,Symbol.Length)==Symbol)
     {
      TemStrArray=TemStrWillCut.Substring (0,i);
      x=Int32.Parse (TemStrArray.Substring (0,MainNum));
      y=Int32.Parse (TemStrArray.Substring (MainNum,SubNum));
      TemStrWillCut=TemStrWillCut.Substring (i+Symbol.Length ,TemStrWillCut.Length -i-1);
      StrArray[x,y]=TemStrArray.Substring (NoUseNumber,TemStrArray.Length -NoUseNumber);
      break;
     }
    }
   }
  }