Hi Nadya,
Good idea! It makes code much simplier.
DO CASE
CASE lcAPNUniform = lcMask
llOk = .T.
CASE NOT LIKE( CHRTRAN(lcMask, "X", "?"), lcAPNUniform )
llOk = .F.
CASE chrtran(lcAPNUniform,'X','9')=chrtran(lcMask,'X','9')
llOk = .T.
OTHERWISE
llOk = .F.
ENDCASE
>
>I have a file with MapRef field filled. Based on this field I calculate APN in the whole file by some algorithm (different function for each town). So, I scan the file and calculate APN for each record. I also want to perform some validation during this loop. I don't want to use RegExp, because it would be much slower, than native VFP functions. I like Sergey's idea. It's simple and doesn't require lots of changes in the current ValidateAPN1 function. His idea could be further simplified, because case 3 could be checked chrtran(lcAPNUniform,'X','9')=chrtran(lcMask,'X','9') since the previous case already checks for difference...
>
>>Nadya --
< snip >
--sb--