You have to find str2 in str before calling replace. The find function will return an index which can be passed to replace (along with the length of str2) to indicate the location of the substring to be removed.

10-14-2008

yahn

Ah, thank you. I read the example wrong, and it looked like replace(p, n, str) only replaced a maximum on n bytes.