Amanpartap

Hi

This is my first post in board.

In a FoxPro database file, i have the following informaiton in one of fields:

microsoft is great
microsoft_is great

In above two values, I want to replace every blank space with an underscore, irrespective of whereever they occur.

like microsoft_is_great

What would be the syntax

Aman

### Re: Foxpro Windows 2.6 - How to replace a blank space with an underscore

CetinBasoz

Welcome.

Code Block
replace myField with chrtran(myField, ' ' ,'_')

### Re: Foxpro Windows 2.6 - How to replace a blank space with an underscore

Amanpartap

Great!! this almost worked but the end result was:

microsoft_is_great__________________________

Can we avoid trailing underscores

Thanks again.

### Re: Foxpro Windows 2.6 - How to replace a blank space with an underscore

Amanpartap

Ok got it thanks

Code Block

replace name with chrtran(alltrim(name), ' ' ,'_')