this is what I have:
Code:
for(i = (loc - theString); i < strlen(theString); i++)
{
for(j = 0; j < strlen(searchFor); j++)
{
printf("\nthe start:%c\n", *(theString + i));
if((counter) < strlen(replace))
*(theString + i) = *(replace + j);
if((counter <= strlen(searchFor) && counter >=
strlen(replace)))
{
differenceMover = strlen(searchFor) - strlen
(replace);
printf("%c\n", *(theString + i));
if(*(theString + i - differenceMover) == '@')
{
*(theString + i - differenceMover) = *
(theString + i);
*(theString + i) = '@';
}
else
*(theString + i) = *(theString + i +
differenceMover);
if(i + differenceMover < strlen(theString))
*(theString + i + differenceMover) = '@';
}
if(counter >= strlen(searchFor))
{
printf("end of loop\n");
i = strlen(theString);
}
else
{
i++;
counter++;
}
}
}
This is the output I am getting:
string: hello
search: ll
replace: i
hilio@