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

how can i remove carriage returns in data

Status
Not open for further replies.

borsker

Programmer
Jul 24, 2002
147
US
I am having problems with customer data. The data comes in clean, however every once in a while there is a carriage return hiding in the data.
When I go to write out the data as a text document, the carriage return knocks the record onto two lines. The result is me going back to the text file to find the break and delete it.
Is there a way I can get rid of the carriage return before or after I write the file out so the carriage return will be removed. I was trying to use the CHRTRAN command but I am getting no success. I am probably using it wrong.
 
Use STRTRAN() with either chr(13) or chr(10) or Chr(13) + Chr(10) <-- depends on the data probably the latter though.

boyd.gif

 

I was trying to use the CHRTRAN command but I am getting no success. I am probably using it wrong.
So how are you using it? What kind of file do you get?

Since you writing it into a text document, I would assume that the carriage returns "hide" in a table, character string or memo type?

Try

REPLACE ALL MyField WITH CHRTRAN(MyField,CHR(13),'')
or, possibly, also
REPLACE ALL MyField WITH CHRTRAN(MyField,CHR(10),'')
 
That was it, I kept trying to use this command
REPLACE ALL MyField WITH CHRTRAN(MyField,CHR(13),'')
and I was not getting a result.

the command
REPLACE ALL MyField WITH CHRTRAN(MyField,CHR(10),'')
works great. Thanks
 
Sometimes you may find only CHR(10) is there, sometimes only CHR(13) and other times both as CHR(13)+CHR(10). Be alert to the possible variations.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top