Showing posts with label string comparison. Show all posts
Showing posts with label string comparison. Show all posts

Wednesday, April 14, 2010

How to use the like operator with string comparisons

If you programmed SQL statements in Ax, you've probably used the like operator in your statement.
Like (!) this

select * from CustTable where CustTable.Name like 'A*'

Something less known about the like operator, is that you can also use it in string comparisons.
Example:

static void LikeOperator(Args _args)
{ str test;
;

test="Dynamics Ax";

if(test like "Dynamics*")
info('OK!');
}




You can use the like operator with your well known wildcards as * and ?
So for example

test like "D?namics*"


As such, it's use is complimentary to the likes of functions as strscan and strfind.