Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I carry out pattern matching
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00207620
Message ID:
00207649
Views:
19
>No but I do know that they will always be in the format
>
>Letter Number Letter Number Letter Number
>
>which is why I thought some sort of mask might be possible

IF that is all you are looking for, then you could try the following
lcPtrn1 = repl( "*", 26 )
lcPtrn2 = repl( "#", 10 )
lcZip  = upper( right( allt( addressfld ), 8 ))
lcZip  = chrtran( lcZIP, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", lcPtrn1 )
lcZip  = chrtran( lcZIP, "0123456789", lcPtrn2 )

if lcZip = " *#* #*#"
  */ this was in the pattern format...
  */ I specifically used right(8) to allow for
  */ a forced space before final zip code, 
  */ otherwise some anomoly in data where I want
  */ that first character to be a space...

  lcAddressFld = left( lcAddressFld, len( lcAddressFld )-8);
               + upper( right( lcAddressFld, 8 ))

endif
HTH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform