Thursday, November 24, 2016

AX 2012: StrFind and StrScan functions


Two standard functions strFind and strScan can be used based on business requirement for find a special character from an input string.

Here is an example with both functions;

Both functions return integer value.

StrScan Function

Int found = 0;
Str target= "Dynamics AX 365 operation";
found = strScan(target, "365", 0, strLen(target));


where parameters are;
1. string
2. string
3. position
4. number

StrFind Function

Int found = 0;
Str target= "Dynamics AX 365 operation";
found = strFind(target, "X", 0, strLen(target));

where parameters are;
1. string
2. character
3. position
4. number

1 comment:

  1. For this case strFind and strScan return different results.
    Example:
    str sString = "ABCD EFG";
    int nValue;
    ;
    nValue = strFind(sString, "F", 1, strLen(sString)); //returns 6
    nValue = strScan(sString, "F", 1, strLen(sString)); //returns - 7
    That the difference between these functions.

    ReplyDelete

I will appreciate your comments !

How to enable new Microsoft teams - Public Preview!

New Microsoft Teams is just AWESOME, quick but useful post below shows how you have this preview feature to make your life EASY!  Open Micr...