[thelist] replacing CRLFs in Memo fields

Ken Schaefer Ken at adOpenStatic.com
Tue Mar 15 07:11:17 CST 2005



: -----Original Message-----
: From: thelist-bounces at lists.evolt.org [mailto:thelist-
: bounces at lists.evolt.org] On Behalf Of Burhan Khalid
: Sent: Tuesday, 15 March 2005 10:28 PM
: To: thelist at lists.evolt.org
: Subject: Re: [thelist] replacing CRLFs in Memo fields
: 
: Pringle, Ron wrote:
: > Ok, two more related questions. I've googled around for this and haven't
: > come across anything. (any links would be appreciated).
: >
: > In my Access 2000 DB I have a memo field that will be taking input from
: a
: > web form. The people using the form will most likely be cutting and
: pasting
: > text from MS Word docs.
: >
: > That memo field will in turn be displayed on the web. I want to preserve
: the
: > paragraph formatting of the original text.
: >
: > 1. How do I go about finding and replacing the CLRFs that are inserted
: in
: > the form field with <p> tags?
: 
: If you are using PHP, you can use the nl2br() function which will do
: this for you (and you can preserve the original format in the database).
: 
: As its name suggests, it converts newlines to break tags.
: 
: Hope this helps

In ASP:
Replace(yourData, vbCrLf, "<br />" & vbCrLf)

In ASP.NET, pretty much the same (assuming you have a string variable):
string.replace(System.Environment.NewLine, "<br />" &
System.Environment.NewLine)

Cheers
Ken


More information about the thelist mailing list