There are a few this missing with your above code:
1. You need to echo the str_replace returned value
2. Please use get_field instead of the_field when returning data to a function
3. Please use the $find and $replace parameters in the str_replace function.