Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replace 1 line break with 2 line breaks in c#

How can I stretch some string element _text from

A
B
C

to

A

B

C

?

Actually, I have some text getting from DB

_text = this.NormalizeString(DinamicLibrary.LoadText(DinamicLibrary.Path[(int)_category] + _textdllName, this.TextNumber));

What should I do with this query or with _text later to get what I want? I understand that I should change \n to \n\n but dunno how.

like image 715
ДМИТРИЙ МАЛИКОВ Avatar asked Dec 05 '22 21:12

ДМИТРИЙ МАЛИКОВ


2 Answers

var result = s.Replace(Environment.NewLine, Environment.NewLine + Environment.NewLine);
like image 196
Kirill Polishchuk Avatar answered Dec 15 '22 00:12

Kirill Polishchuk


string newString = oldString.Replace("\n", "\n\n");
like image 21
Petar Ivanov Avatar answered Dec 14 '22 23:12

Petar Ivanov