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

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...