Kurs C++ Lekcja 29 Zadanie Domowe - Metoda find
Ostatnio zmodyfikowano 2016-01-23 14:43
Bledis Temat założony przez niniejszego użytkownika |
Kurs C++ Lekcja 29 Zadanie Domowe - Metoda find » 2016-01-23 14:43:40 Problem w tym że metoda find znajduję fragment tekstu "<\b>" na pozycji 4000+, nie mam pojęcia dlaczego tak jest... #include <iostream> #include <string>
using namespace std;
std::string konwertuj( std::string & sTekst ) { size_t pozycja1 = sTekst.find( "<b>" ); sTekst.erase( pozycja1, 3 ); sTekst.insert( pozycja1, "[b]" ); size_t pozycja2 = sTekst.find( "<\b]>" ); sTekst.erase( pozycja2, 4 ); sTekst.insert( pozycja2, "[\b]" ); string sWynik = sTekst; return sWynik; } int main() { std::string tekst = "<b>to jest </b> testowy napis <b>:)"; std::cout << konwertuj( tekst ) << std::endl; return 0; }
|
|
« 1 » |