- void SplitString(string &ArrayRes[],string InputString,string splitter)
- {
- string temp,tempArray[100];
- int pos,splitLength=StringLen(splitter),InputStrLength=StringLen(InputString),counter;
-
- pos=StringFind(InputString,splitter);
- if (pos!=-1)
- {
- if (pos==0) InputString=StringSubstr(InputString,splitLength,InputStrLength-splitLength);
- while (StringFind(InputString,splitter)!=-1)
- {
- pos=StringFind(InputString,splitter);
- InputStrLength=StringLen(InputString);
- tempArray[counter]=StringSubstr(InputString,0,pos);
- InputString=StringSubstr(InputString,pos+splitLength,InputStrLength-splitLength-pos);
- counter++;
- }
- if (StringLen(InputString)!=0)
- {
- tempArray[counter]=InputString;
- counter++;
- }
- }
- ArrayResize(ArrayRes,counter);
- for (int i=0;i<counter;i++)
- {
- ArrayRes[i]=tempArray[i];
- //Print("i=",i," string=",ArrayRes[i]);
- }
- return;
- }
-
-
-
复制代码
|