Replace all fragments in the string with other fragments.

Call:

string sresult = strreplace(string s, string fragmentold, string fragmentnew, int how, int pos, int count);


Here:

s - string in which to replace fragment fragmentold with fragmentnew,

how - where to retreat the beginning - 0/1/2 - all/from the beginning/from the end

pos - how much to retreat

count - how much to replace (-1 - completely).


Example.

Convert a floating point number to a string and replace the dot separating the integer and fractional parts with a comma.

double d_value = 126.983;
string s_value = sprintf("%10.3f", d_value);
s_value = strreplace(s_value, ".", ",", 0, 0, -1);
Результат - 126,983