Port's is good, assuming that you want to search for something up until a point.
If you want to replace it no matter what's there, here is the code you should use:
function replaceUpTo(%String, %UpToChar, %Replacement, %AlwaysReplace)
{
//If %AlwaysReplace is false and %UpToChar is not found, then return.
//Otherwise, return the replacement.
%Pos = strPos(%String, %UpToChar);
if(%Pos <= 0 && !%AlwaysReplace)
return %String;
else if(%Pos <= 0 && !!%AlwaysReplace)
return %Replacement;
return %Replacement @ getSubStr(%String, %Pos + 1, strLen(%String);
}