separate the string.

Hi I am having following string

Eg: “552100-1100-12-000000-110-006”

and

MyTable has 6 fields field1,field2,field3,field4,field5,field6

how to separate them one by one and store it in table. and I have to remove the dash(-) and

pick the 1st string and store it in field1 i.e 552100 , similarly 2nd string in field 2 ie 1100… and 6 in field

i want to store the it as follows in MyTable.

field1 field2 field3 field4 field5 field6

552100 1100 12 000000 110 006

thank you

This is the most condensed way:

MyTable mt;
;
[mt.Field1, mt.Field2, mt.Field3, mt.Field4, mt.Field5, mt.Field6] = str2con('552100-1100-12-000000-110-006', '-');

Hi Martin Drab,

Thanks for your replay. The problem i am facing is that when i use container its storing 0000 as 0 but I want to show 0000.

how to solve it.

the code is

Job12()

{

container c;

;

s= “552100-1100-12-000000-110-006”;

c = str2con(s,"-");
conview(c);

}

but the 4th 000000 but its showing as 0. I want it as 000000 as it is.

can any one help please. I think it can be done by only arrays of type string as string store it as ‘000000’ but if i take integer array it will store 000000 as single zero only ie 0.

how to solve this any one can help please.