Divided into to ":" divide the array and traversal of each member
CodePudding user response:
AnsiString edit="11:12:34 3:32:57 for 8";AnsiString xx [100];
Int ll, I;
i=0;
Ll=edit. Pos (" : ");
While (ll)
{
Xx [I]=edit. The SubString (1, ll - 1);
Edit=edit. The SubString (ll + 1, edit. The Length ());
Ll=edit. Pos (" : ");
i++;
}
Xx [I]=edit;
Ll=I;
for (i=0; I & lt;=ll; I++)
{
ShowMessage (xx [I]);
}
CodePudding user response:
On the first floor, that's no problemCodePudding user response:
With TStringList DelimitedText and Delimiter is more simple,CodePudding user response:
Can use TStringList DelimitedText to break down, is as follows:String strSource (" a, b, c, d, e ");
TStringList * pList=new TStringList;
PList - & gt;=', 'Delimiter.//specify comma for separators
PList - & gt; DelimitedText=strSource;
.
PList - & gt; The Count is decomposed, section number corresponds to the length of the array
PList - & gt; Strings [I] is every member
.
The delete pList.