QString str1 = "лат."; str1.replace("лат.", "латинского"); QString str2 = "лат."; str2.chop(1);
string text= Utf8::encode( no.tagAtt );QString str = text.c_str();if ( str.endsWith( "." ) ){str.chop(1);string bloc = str.toStdString();string rez = string( "hello" ) + bloc + "!";}
C++ (Qt)std::string MyFindAndReplace( const std::string & src, const char * match, const char * replace ){ std::string dst; size_t prv = 0, mlen = strlen(match); while (true) { size_t nxt = src.find(match, prv); if (nxt != std::string::npos) { dst.append(src.c_str() + prv, nxt - prv); dst += replace; prv = nxt + mlen; } else { dst.append(src.c_str() + prv); break; } } return dst;}