Replace en C++

Delphine -  
mamiemando Messages postés 33778 Date d'inscription   Statut Modérateur Dernière intervention   -
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....

1 réponse

mamiemando Messages postés 33778 Date d'inscription   Statut Modérateur Dernière intervention   7 884
 
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.htm
string& 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
0