Implement method for replace characters.