Help on string in ax 2012

Hi All,

I want to know how to retrieve only 1st 3 characters from a given string in a container.

Example: i have a container c with value**"-#@x%yz-&ADF"**

i want to retrieve only 1st 3 characters that is “xyz”.

Thanks in advance



Try this

static void Job36(Args _args)
container cnt;
str temp;

cnt = conIns(cnt,1,"-#@x%yz-&ADF");
temp = strDel(strAlpha(conPeek(cnt,1)),4,3);


strAlpha() is a good choice, if you’re interested in all alphanumeric characters (and nothing else). strKeep() is an alternative if you need more flexibility.

To get first three chaacters, subStr() is the usual choice.

If you don’t know these functions by heart, look at system functions in AOT or at the online documentation, as shown by my links above. You should also check the Global class, because you’ll find more useful methods there (e.g. strContains()).

Hi Lalit and Martin,

Thank you so much for your kind guidance, i am able to get it now.