Last I have to logic that if text contain contains “-“ then validate the length of string 9 other wise at 8.
I did it with strscan function of X++ or dynamics ax 2012. Full code as follow.
Int found=0;
Str target=”Aliraza-zaidi”;
found = strscan(target,”-“,found,strlen(target));
//this function return the position of character if it found.
If (found!=0)
{
Info (“charater found”);
}
Else
{
Info (“character not found”);
}