2011-03-08 50 views
0

我有一个字符串变量svcName="serviceName",我必须追加"Base"这个字符串在svcName字符串的末尾。并存储到另一个字符串中。如何追加两个字符串?

+7

char * or std :: string? – dandan78 2011-03-08 09:36:18

+0

如何思考?如何变得聪明? – 2011-03-08 14:08:37

回答

4
#include <string> 
std::string s = "abc"; 
s += "def"; 
2

如果您需要更复杂的字符串建筑,你也可以使用一个std::stringstream