std::
string textStr = element.text;
std::
string lines;
int len = 40;
if(element.text.length() > len){
for(
int cur = 0; cur < len;){
char t = textStr[cur];
if((t&0xE0) == 0xE0){
//3byte
lines = lines + t + textStr[cur+1] + textStr[cur+2];
cur += 3;
}
else if((t & 0xC0) == 0xC0){
//2byte
lines = lines + t + textStr[cur+1];
cur += 2;
}
else {
//1byte
lines = lines + t;
cur += 1;
}
}
textStr = lines + "
";
CCLog("streaming text:%s", lines.c_str());
}