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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find and replace 2 or more spaces 7

Status
Not open for further replies.

borsker

Programmer
Jul 24, 2002
147
0
0
US
I have a field that sometimes has multiple blanks in the data. for example "myfirst mylast" and it needs to be "myfirst mylast". i am using this command but i do not know how to look for more than one character at a time. is this even possible?

REPLACE ALL cField WITH CHRTRAN(cField,CHR(32),'')

Thanks you for any answers.
 
set library to (home()+'foxtools.fll') additive

that worked great thanks.

thanks again for all the help
 
Some additional tests:

Code:
Set Library To Home()+"Foxtools.fll"

* 1. Reduce does not need the second parameter
? Len(Reduce(Space(5)))
* 2. Reduce includes Alltrim()-Functionality already:
? Len(Reduce(Space(3)+"a"+Space(3)))
* 3. Reduce by default also replaces Tabs (Whitespace);
with a single Space:
? Len(reduce("a"+Space(5)+Chr(9)+"z"))
* 4. If You specify that you only want to reduce spaces;
with a single space, then the parameter is needed:
? Len(reduce("a"+Space(5)+Chr(9)+"z",Space(1)))
* => Chr(9) is kept
* 5. You may reduce other characters as well as;
chr(13) amd chr(10) to remove line feeds, too:
? Len(Reduce(cText,Space(1)+chr(13)+chr(10)+chr(9)))

These examples may show better, how Reduce works.

Bye, Olaf.
 
Thanks everyone for all the stars.

Sometimes you earn them hard, sometimes very easy.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top