我想製作一個函數,可以從字符串中斷行。使用正則表達式替換
如: 「1」 - > 「\ N1。」
,所以我可以這樣寫
string Input = "1. First option";
Input += "2. Second option";
Input += "3. Third option";
Output = WriteMenu(Input);
代碼,並得到這樣
"1. First option
\n2. Second option
\n3. Third option"
字符串該模式將始終爲[數字] [點] [空格]。 如果第一個選項帶有新行,這不是問題。
所以僅僅是明確的(因爲它似乎目前的答案都忽略了這):你**不需要''''前面的CRLF? – slugster 2012-04-04 00:15:42