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!

How to remove spaces from within string

Status
Not open for further replies.

kmagy

MIS
Oct 21, 2003
38
JO

Hi Every Boby

Please help me to remove extra spaces that the user inserted without noticing it inside a string

eg. "abc def" to be "abc def"


Thanks
 
If you have vfp9 use :
trim(stringname,1,' ')
else use "
stringname=strtran(oldstringname,' ','')

Rob.
 
This will work:
Code:
? STRTRAN( "abc         def"," ","",2)


Regards

Griff
Keep [Smile]ing
 
doubleSpace = CHR(32) + CHR(32)
DO WHILE AT(doubleSpace,yourString) > 0
yourString = STRTRAN(yourString,doubleSpace,CHR(32))
ENDDO
 
Look at the Reduce() function in the FoxTools library. It should give you exactly what you need.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top