I am trying to join two lines in a text file and write as one line without a line feed,but the combined line is being forced to several line feeds.

What I have on original file:

[line1:abcdefghijklm CR

line2:nopqrstuvwxyz CR


What i need:



What I am currently getting:

[output:abcdefghijklmnopq CRLF

rstu CRLF

vwxyz CRLF]

Line 2 gets joined to line 1 ok,but then line two gets broken into several line feeds.

I have tried replace method on ("\r","") but the output is still the same,irregardless of the text editor that i use,i.e notepad++,ultrastudio,notepad and visual studio.

Please advise,see code below,this is after reading both lines:

output=line1.TrimEnd+" "+line2;

If I recall right the Trim function actually removes all white space (leading or trailing depending on which variation of Trim you use).

White Space includes Carriage Returns and Line Feeds

Also, how are you not getting an error with that TrimEnd written like that. Don't you need parenthesis after it?

But back on track. Try something like

output = (line1.Trim() + line2.Trim() + "\r\n"); 

(might wnat to make sure I used the right characters for CR and LF)

(Okay now I am curious how that TrimEnd isn't blowing an error, and even more has me wondering if it ties into the interesting pattern you showed above ... have to try that tonight at home)

commented: Nice! +15