|
Home > Archive > Getting Started with dBASE > August 2005 > routine to strip special characters
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
routine to strip special characters
|
|
| Maxine 2005-08-08, 1:23 pm |
| I've checked the shared code postings and can't find what I need. Is there a routine to read each character of a variable and reformatting to strip out allspaces and all special characters? I think someone wrote this on the 5.7 format?
Thx
| |
| Rick Gearardo 2005-08-08, 1:23 pm |
| func strp(x)
local n, l
n = ""
l = len(x)
for i = 1 to l
if .not. spChar(asc(substr(x,
i,1)))
n = n + substr(x,i,1)
endif
next
return n
func spChar(x)
local rVal
rVal = true
if x // is a special character - add the acsii code for whatever
characters you're trying to strip
rVal = false
endif
return rVal
"Maxine" <mml8706@pacbell.net> wrote in message
news:09SPQZDnFHA.1756@news-server...
> I've checked the shared code postings and can't find what I need. Is
> there a routine to read each character of a variable and reformatting to
> strip out allspaces and all special characters? I think someone wrote
> this on the 5.7 format?
> Thx
| |
| Gerald Lightsey 2005-08-08, 8:23 pm |
| On Mon, 08 Aug 2005 12:29:13 -0400, in the dbase.getting-started group,
Maxine said...
> I've checked the shared code postings and can't find what I need.
> Is there a routine to read each character of a variable and
> reformatting to strip out allspaces and all special characters?
> I think someone wrote this on the 5.7 format?
> Thx
function StripLow(Input)
local cTrimmed, cString
cTrimmed = ltrim(rtrim(Input))
cString = ""
for i = 1 to len(cTrimmed)
cVal = substr(cTrimmed,i,1)
cString = iif(asc(cVal) <= 32,cString,cString + cVal)
endfor
return cString
Gerald
|
|
|
|
|