Friday, March 21, 2014

Remove Aplhabet in Prefix and Suffix through X++

//Remove Aplhabet in Prefix and Suffix


static void removeAplhabetic_Prefix_Suffix(Args _args)
{
    int i = 0;
    int whereFound;
    str myString = "Sangeeth91004352000DynamicsAX";
    ;
    if(!isInteger(myString))
    {
        for(i=0 ; i < strlen(myString); i++)
        {
            whereFound = strnFind(myString, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" , 1, strLen(myString));
            if(whereFound > 1)
            {
                myString = strdel(myString,1,1);
            }
        }
        for(i=strlen(myString); i > 0; i--)
        {
            whereFound = strnFind(myString, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ,strLen(myString), -strLen(myString));
            if(whereFound <= strlen(myString)-1)
            {
                myString = strdel(myString,strlen(myString),1);
            }
        }
    }
    info(myString);
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...