更新时间:2023-12-04 13:23:40
使用 ^ ]方法,即:
Split theTextBox
''sText
property using the String.Split[^] method, that is:
string[] sep = new string[] {"\r\n"};
string[] lines = textBox.Text.Split(sep, StringSplitOptions.RemoveEmptyEntries);
您将得到一个由string
组成的数组,每个数组对应于另一行.
you get an array of string
s, each one corresponding to a different line.
您可以使用 ^ ].
示例:
You can use Regex.Split()[^] for this.
Example:
string[] lines = Regex.Split(txtAddress.Text, "\r\n");
<asp:textbox id="TextBox1" runat="server" textmode="MultiLine" height="100px" width="300px" :asp="#unknown">
<asp:button id="Button1" runat="server" text="Button" asp="#unknown" />