我試過gsub(「[\ r \ n] +」,「\ r \ n」,textDoc)分別處理\ r和\ n,而不是單個字符串?R - 正則表達式 - 用一個替換多個 r n(CRLF) r n
編輯 -
"This is a line! It ends with a CRLF!\r\n
\r\n
\r\n
There is more stuff down here! I want it directly below the other stuff! Get rid of those two blank lines! Actually, ANYTIME I have blank lines, lets remove them!\r\n"
需要更清晰地解決這個問題。 – 2016-04-03 20:48:24
在示例字符串中添加。 – Jibril