Home  |  Index  |  Dotnet4all Snippets  |  Submit resources
About  |  Mail us  
Dotnet4all Logo
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:

Anonymous Anonymous said...

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.

10:53 AM  

Post a Comment

<< Home

 
Previous Posts
    - How to read the content of an external website in ...
    - How to late bind an object, using the 'old' Prog.I...
    - How to parse an ASP.NET page.
    - How to determine wether a string fits in a textbox...
    - How to play sounds using the .NET framework
    - Howto convert strings from lower case to upper cas...
    - How to read images from an Access database (OLE ob...
    - How to Print from a rich text box
    - Pure ASP.NET
    - Visual Basic .NET Code Security Handbook

Archives
    - 08/01/2004 - 08/08/2004
    - 08/08/2004 - 08/15/2004
    - 08/15/2004 - 08/22/2004
    - 08/22/2004 - 08/29/2004
    - 08/29/2004 - 09/05/2004
    - 09/05/2004 - 09/12/2004
    - 09/12/2004 - 09/19/2004
    - 09/19/2004 - 09/26/2004
    - 09/26/2004 - 10/03/2004
    - 10/03/2004 - 10/10/2004
    - 01/02/2005 - 01/09/2005
    - 01/09/2005 - 01/16/2005
    - 01/30/2005 - 02/06/2005
    - 01/01/2006 - 01/08/2006


Disclaimer & Terms of Use  | DotNet4All.Com concept & © 2004 - 2007 by  Zelders²  - Holland