Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Old Version Help

Status
Not open for further replies.

bueller

Programmer
Aug 27, 2002
76
US
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
 
Um, I think you're confusing VB and FP syntax. In FoxPro, we concatenate strings with '+' (or in special cases '-'). In FP, the '&' singly is the macro introduction character or two (or more) together will comment the rest of the line.

Rick
 
rgbean,

Thanks a bunch that worked perfectly. yes i am a VB guy by trade but can still hack up some VFP.
-Bueller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top