Replace en C++
Bonjour,
Je me demander s'il existait une fonction en c++ qui permette de faire
replace() sur des chaines de carateres.
Merci
A+
PS: Cela fai tun petit mmoment que je cherche masi sans succès....
Je me demander s'il existait une fonction en c++ qui permette de faire
replace() sur des chaines de carateres.
Merci
A+
PS: Cela fai tun petit mmoment que je cherche masi sans succès....
1 réponse
-
Hum tu es sûr d'avoir bien cherché ?
http://www.google.fr/search?q=stl+string+replace
donne
http://www.msoe.edu/eecs/cese/resources/stl/string.htmstring& replace(size_type pos, size_type n, const string& str);
Delete a substring from the current string, and replace it with another string. The substring to be deleted is specified in the same way as in erase, except that there are no default values for pos and n.string str14 = "abcdefghi"; string str15 = "XYZ"; str14.replace (4,2,str15); cout << str14 << endl; // "abcdXYZghi" Note: if you want to replace only a single character at a time, you should use the subscript operator ([]) instead.
Bonne chance