How to replace space as a newline in a textBox with Multiline property set to true?

后端 未结 5 926
闹比i
闹比i 2021-01-28 23:14

Suppose I have this string:

string str = \"The quick brown fox     jumps over the lazy dog\";

How can I replace or ignore the spaces in the str

5条回答
  •  一整个雨季
    2021-01-28 23:59

    If you want compact and simple this may be the best bet:

    Textbox.Lines = MyString.Split(' ');
    

    If you're wanting to split the text already in the box this may work:

    Textbox.Lines = Textbox.Text.Split(' ');
    

提交回复
热议问题