我想做一个从字符串中换行的函数。
例如:“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"
模式将始终为 [number][dot][whitespace]。如果第一个选项带有新行,这不是问题。