>I need to check if there are characters outside of a list of valid characters. For example A-Z,a-z,0-9, are valid characters, how can I tell if an address has a value outside of these. I know I'm going to be using ASCII values, but what's the best way to search through the string? I use your method a lot myself when I know what I'm looking for. In this case it could be a rather large set of invalid characters, so I don't think it would be the best choice here.
Just a suggestion...
Call this ValAddrStr from txtAddress.Valid.
FUNCTION ValAddrStr
LPARAMETER lcAddrStr
LOCAL llRetValue
llRetValue = .T.
FOR lnI = 1 TO LEN(m.lcAddrStr)
IF NOT ( BETWEEN( SUBSTR(m.lcAddrStr, m.lnI, 1), 'A', 'Z' ) ;
OR BETWEEN( SUBSTR(m.lcAddrStr, m.lnI, 1), 'a', 'z' ) ;
OR BETWEEN( SUBSTR(m.lcAddrStr, m.lnI, 1), '0', '9' )
llRetValue = .F.
EXIT
ENDIF
ENDFOR
RETURN m.llRetValue
HTH,
Rich.
Rich Addison, Micro Vane, Inc., Kalamazoo, MI
Relax, don't worry, have a homebrew.
- Charlie Papazian, The New Complete Joy of Home Brewing