How to replace a line feed in a string with a <BR> tag
(Thursday, August 19, 2004)
Replacing a line feed in a string with a <BR> tag
There are multiple way to replace parts of a string with another parts of a string. In this snippet two examples. The first way is the most common way:
//VB MyString = Replace(MyString, vbCrLf, "<BR>")
But there is a more efficient way, using the stringbuilder.
//C# StringBuilder MyStringBuilder = new StringBuilder(myString); MyStringBuilder = MyStringBuilder.Replace("\r\n","<BR>"); myString=MyStringBuilder.ToString();
Posted by Xander Zelders

|
1 Comments:
Do you also know how a TAB is saved in a database text field?
I would really like to know and can not find it.
Post a Comment
<< Home