A: 去掉字符串中的空格
string tempString = text;
int begin = 0;
begin = tempString.find(" ",begin); //查找空格在str中第一次出现的位置
bool needset = false;
while(begin != -1) //表示字符串中存在空格
{
needset = true;
tempString.replace(begin, 1, ""); // 用空串替换str中从begin开始的1个字符
begin = tempString.find(" ",begin); //查找空格在替换后的str中第一次出现的位置
}
if (needset)
{
editBox->setText(tempString.c_str());
}