Hi,
Today I would like to share you x++ code to insert space between the characters in a string in AX.
Example 1:
static void insertSpaceBtwString(Args _args)
{
str s,s1;
int i,j;
s="KORCOMPTENZ";
j= strLen(s);
for(i=1;i<=j;i++)
{
s1=s1+subStr(s,i,1);
if(i!=strLen(s))
s1=s1+ " ";
}
info(s1);
}
Output:
Example 2:
Inserting space after each four digit Number
static void InsertSpace(Args _args)
{
str s,s1;
int i,j;
s="1245678945612355";
j= strLen(s);
for(i=1;i<=j;i=i+4)
{
s1=s1+subStr(s,i,4);
if(i+4<=j)
s1=s1+" ";
}
info(s1);
}
Output:
Happy Daxing....
No comments:
Post a Comment