IWeb Posted November 11, 2003 Posted November 11, 2003 Hello, How can I replace line breaks in vb.net from a string? I just tried to replace the substring "\n" but this won't work. thank you, Quote
Administrators PlausiblyDamp Posted November 11, 2003 Administrators Posted November 11, 2003 theString.Replace(Chr(10) & Chr(13),"") should do it Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
*Experts* Volte Posted November 11, 2003 *Experts* Posted November 11, 2003 Actually CRLF is 13 and 10, not vice versa. Plus Chr() is part of the VB compatability library, so if you want to avoid it you could do something like this:theString = theString.Replace(System.Text.Encoding.ASCII.GetString(New Byte() {13, 10}), "")A little longer, but I personally try to write code that stays the same (except syntax of course) between VB.NET and C# - Chr() will not work in C#. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.