Wednesday, 18 November 2015

Get the String values from String separated by Delimiter


Requirement : To separate values from String with Pipe Delimited Values.

static void ValueFromStringSepdeli(Args _args)
{
    citInboundLineData x;
    container c;
    SalesShippingDate shipdate;
    int i;

    x= "SOPack"+"|"+"SO1"+"|"+"PR1"+"|"+"item1"+"|"+"10"+"|"+"25/5/2015"+"|"+"tn1";
    c = str2con(x,"|");
    //conview(c);
     for (i=1; i <= conLen(c); i++)
    {
        info (strFmt("container value %1 is %2", i, conPeek(c, i)));
    }
    shipdate    =   str2Date(conPeek(c,6),123);
    info(strFmt("%1",shipdate));
}

static void Job9(Args _args)
{
    citInboundLineData x;
    container c,toc;
    SalesShippingDate shipdate;
    int i;
     x= "SOPack"+","+"000185"+","+"PR1"+","+"T0004"+","+"10"+","+"12/31/2015"+","+"tn1";
    //toc =   con2Str(x, "|");
    toc = str2con(x,",");
    x = con2str(toc,"|");
    info(x);
    c=  str2con(x,"|");
    conview(c);
 
}

No comments:

Post a Comment