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

replace multiple carriage returns

Status
Not open for further replies.

atarrqis

IS-IT--Management
Nov 26, 2004
155
US
I'm using cr8.5 with Oracle
I need to do a replace on a text string so that where ever there is two carriage returns in a row I will only have one. I know how to replace one carriage return:
replace({table.text},chr(13)," ")

I can't figure out the correct syntax for the replace when I'm trying to find two chr(13) in a row.
replace({table.text},"chr(13)chr(13)"," ")
 
Try:

replace({table.text},chr(13)+chr(13),chr(13))

Can't recall the exact syntax, that looks ok.

-k
 
good idea but no, that still doesn't do it.
 
Try posting specifics, does it error, or?

If it doesn't error, then your theory is incorrect, there aren't 2 consecutive Carriage Returns.

Often times there is a carriage return+line feed, which is a chr(10)

But you need to post more than, no, that doesn't do it.

You should try disaovering what is in the field by copying and pasting it into a formula of:

asc("<paste here>")

-k
 
If it isn't line-feed, then consider spaces between the feed characters.

Try a test report to see what really is there. Change the feeds into something visible, e.g.
Code:
replace({table.text},"chr(13)chr(13)","CHR_13")
Find out what the data really is.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
The string contains chr(13)chr(10) so that I get
9318 Nalini#$#$Urbana, IL#$61801#$
if I use
replace(replace({table.text},chr(13), "#"),chr(10),"$")

I only want to remove where there is a double (#$#$)
not a single set (#$) but I can't get the syntax for 'instr' to work correctly.
 
Try:

replace({table.field},chr(13)+chr(10)+chr(13)+chr(10),chr(13)+chr(10))

-k
 
Try this:

replace({table.text},chr(13)+chr(10)+chr(13)+chr(10),chr(13)+chr(10))

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top