in src/strings.c [873:904]
int STRING_replace(STRING_HANDLE handle, char target, char replace)
{
int result;
if (handle == NULL)
{
/* Codes_SRS_STRING_07_046: [ If handle is NULL STRING_replace shall return a non-zero value. ] */
result = MU_FAILURE;
}
else if (target == replace)
{
/* Codes_SRS_STRING_07_048: [ If target and replace are equal STRING_replace, shall do nothing shall return zero. ] */
result = 0;
}
else
{
size_t length;
size_t index;
/* Codes_SRS_STRING_07_047: [ STRING_replace shall replace all instances of target with replace. ] */
STRING* str_value = handle;
length = strlen(str_value->s);
for (index = 0; index < length; index++)
{
if (str_value->s[index] == target)
{
str_value->s[index] = replace;
}
}
/* Codes_SRS_STRING_07_049: [ On success STRING_replace shall return zero. ] */
result = 0;
}
return result;
}