我想制作一个函数,可以从字符串中断行。使用正则表达式替换
如: “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