07 January 2011

Comma separated Values find in string using container

To Separate the values in the string
1.
static void commaSeperateJob(Args _args)
{
str s= "kranthi,kumar,Myname";
int i=1,j;
str s1,s2;
container c;
;
j = strlen(s);
for(i = 1; i <= j ; i++) { if(substr(s,i,1) != ",") s1 += substr(s,i,1); if(i>1 && substr(s,i,1) == "," || i == j)
{
c = c + [s1];
s1 = "";
}
}
conview(c);
pause;
}
2.
---------------------
static void Job(Args _args)
{
container c;
str s;
;
s= "kranthi,kumar,Myname";
c = str2con(s,",");
conview(c);
}
---------------------
3.
static void Cont(Args _args)
{
container c;
str s,s2;
str s3[];
int i,k;
;
s= "one,two,three";

c = str2con(s,",");
k = conlen(c);
// conview(c);
for(i =1; i <= k; i++)
{
s3[i] = conpeek(c,i);
print s3[i];
}
pause;
}

No comments:

Post a Comment

Give me the commetns and solutions

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...