如何在c ++中将字符串添加到托管字符串?

时间:2018-03-26 18:49:05

标签: c++

在最后一行代码中我尝试将“a”添加到我的字符串中,该字符串在“main.cpp”中提供了警告:多字符字符文字(潜在的可移植性问题),行:30,Col:35

ManagedString accelerometerVectorsString = "";


vector<int> accelerometerVectors;

accelerometerVectors.push_back(uBit.accelerometer.getX());
accelerometerVectors.push_back(uBit.accelerometer.getY());
accelerometerVectors.push_back(uBit.accelerometer.getZ());
for (int i = 0; i < accelerometerVectors.size(); ++i)
{
    accelerometerVectorsString = accelerometerVectorsString + (ManagedString)accelerometerVectors[i] + ' ';
}
accelerometerVectorsString = 'a,' + accelerometerVectorsString;

1 个答案:

答案 0 :(得分:4)

df.col1.str.extractall('(.)')[0].unstack() match 0 1 2 3 0 A G C T 1 A G C T 不是字符文字,因为使用单引号会表明。它是一个多字符文字,所以你想要双引号; 'a,'