Tuesday, February 4, 2003 you wrote:
PS> nybody know a function in ASP that does a similar thing as the
PS> ParagraphFormat function? I've got a SQL database that has fields
PS> with large blocks of text (many paragraphs long). In the sql
PS> tables, the paragraphs are separated by dual carriage returns.
PS> I need to bring the text out of the database and format it in an
PS> asp page with the dual carraige returns replaced by <p> tags for
PS> correct paragraph appearance. I have been using CF for this stuff
PS> but for reasons I won't go into need to convert to asp for
PS> temporary purposes.
You'll need to check but probably your dual carriage returns are
actually a pair of Carriage Return Line Feed characters.
Also, you don't mention your programming language.
Assuming you are using VBScript then you'd do something like:
strText = replace(strText, vbCrLf & vbCrLf, vbCrLf & "<p>")
which "says" inspect the string strText and wherever a pair of CRLF
characters are found replace them with one CRLF and one "<p>"
(paragraph) tag. (if you can't ref vb constants then use Chr(10)
& chr(11) or whatever it is - I forget)
In PerlScript:
$strText =~ s/(\r\n){2,}/\r\n<p>/g;
and etc for the other scripting languages.
hth -
Terry Fritts
To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/