By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,864 Members | 1,321 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,864 IT Pros & Developers. It's quick & easy.

Remove multiple Chr(13) & Chr(10)

P: n/a
Has anyone cunstructed a function to remove multiple carriage returns
and replace it with a single return?

Replace(mytext, Chr(13) & Chr(10) & Chr(13) & Chr(10), Chr(13) &
Chr(10)) ...

only works to remove double carriage returns.

Thanks.
lq

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
lauren quantrell wrote:
Has anyone cunstructed a function to remove multiple carriage returns
and replace it with a single return?

Replace(mytext, Chr(13) & Chr(10) & Chr(13) & Chr(10), Chr(13) &
Chr(10)) ...

only works to remove double carriage returns.

Thanks.
lq


If you don't need anything elegant or efficient :-):

Do While InStr(mytext, Chr(13) & Chr(10) & Chr(13) & Chr(10)) > 0
mytext = YourFunction(mytext)
Loop

Post back if you need something better.

James A. Fortune

Nov 13 '05 #2

P: n/a
ji********@compumarc.com wrote:
lauren quantrell wrote:
Has anyone cunstructed a function to remove multiple carriage returns
and replace it with a single return?

Replace(mytext, Chr(13) & Chr(10) & Chr(13) & Chr(10), Chr(13) &
Chr(10)) ...

only works to remove double carriage returns.

Thanks.
lq

If you don't need anything elegant or efficient :-):

Do While InStr(mytext, Chr(13) & Chr(10) & Chr(13) & Chr(10)) > 0
mytext = YourFunction(mytext)
Loop

Post back if you need something better.

James A. Fortune

A little simpler would be:

Do While Instr(1,mytext,vbCrLf & vbCrLf)
mytext=Replace(mytext,vbCrLf & vbCrLf, vbCrLf)
Loop

--
This sig left intentionally blank
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.