,如果我有一个字符串作为这样删除 ' n n。' C++
"I am not here... \n..Hello\n.\n....Whats happening"
我想要替换上面的字符串这样:
"I am not here... \n..Hello\n. \n....Whats happening"
^Space added
只是有点上的背景是什么我正在做。我在C++中使用sendmail和\n.\n
是End Of Message
等效的sendmail。我刚刚创建了一个使用sendmail发送邮件的类。但显然如果来自outsite的用户给了sendmail这个命令我希望它被删除。这里是我的留言功能just incase .:
//Operator to add to the message
void operator<<(string imessage){
if (imessage != ""){ message += imessage; }
}
我该如何去做这件事。提前致谢:D
不要忘记检查消息的* start *处的'。\ n'。 – 2010-02-01 02:09:15
在发送邮件之前在邮件的开始和结尾添加新行可能是一个更好的主意。无论如何,这都是编码过程的一部分。 – Potatoswatter 2010-02-01 02:30:20
Ooo谢谢。 :D'。\ n'忘记了这一点。 :D – 2010-02-02 12:18:39