Hi all,
I have been trying to get this code below to compile or am open for a better method to do it with. I need to strip out illegal characters that users might enter into a textbox. I have a routine that should work but keeps error and i have no clue why. This is written in VFP 6.
thanks in Advance,
Bueller
Function CleanString(lstrData)
local lstrReturn
local lintLength
local lintHolder
local lintSimple
lintLength = len(lstrData)
lintHolder = 1
lstrReturn = ''
lintSimple = 0
DO WHILE .T. && Begins loop
IF lintHolder = lintLength
EXIT
ENDIF
lintSimple = asc(substr(lstrData,lintHolder,1))
DO CASE
CASE INLIST(lintSimple,39,95,42,34,38,37)
&&lstrReturn = lstrReturn & ' '
OTHERWISE
lstrReturn = lstrReturn & chr(lintSimple) <--doesnt like this
ENDCASE
lintHolder = lintHolder + 1
ENDDO
Return lstrReturn
EndFunc
I have been trying to get this code below to compile or am open for a better method to do it with. I need to strip out illegal characters that users might enter into a textbox. I have a routine that should work but keeps error and i have no clue why. This is written in VFP 6.
thanks in Advance,
Bueller
Function CleanString(lstrData)
local lstrReturn
local lintLength
local lintHolder
local lintSimple
lintLength = len(lstrData)
lintHolder = 1
lstrReturn = ''
lintSimple = 0
DO WHILE .T. && Begins loop
IF lintHolder = lintLength
EXIT
ENDIF
lintSimple = asc(substr(lstrData,lintHolder,1))
DO CASE
CASE INLIST(lintSimple,39,95,42,34,38,37)
&&lstrReturn = lstrReturn & ' '
OTHERWISE
lstrReturn = lstrReturn & chr(lintSimple) <--doesnt like this
ENDCASE
lintHolder = lintHolder + 1
ENDDO
Return lstrReturn
EndFunc