MATLAB: How to replace a word in a string with ****

strings

Hello I have a text file where I am supposed to compare the strings in the text file with the words in another text file. After finding the word that I want to replace, how do I replace it? The first thing I did was use strfind to find the word. After that I have to replace the word with **?
str = 'Long day';
word = 'Long';
t = strfind(str, word);
After doing this I get 1. Now how do I change 'Long day' to '**** day'? The word can be of any length, so you may need more ********.
Thank you

Best Answer

Try
str = strrep( str, 'Long', '****' );