FreeMat
|
Section: String Functions
Replace every occurance of one string with another. The general syntax for its use is
p = strrep(source,find,replace)
Every instance of the string find
in the string source
is replaced with the string replace
. Any of source
, find
and replace
can be a cell array of strings, in which case each entry has the replace operation applied.
Here are some examples of the use of strrep
. First the case where are the arguments are simple strings
--> strrep('Matlab is great','Matlab','FreeMat') ans = FreeMat is great
And here we have the replace operation for a number of strings:
--> strrep({'time is money';'A stitch in time';'No time for games'},'time','money') ans = [money is money] [A stitch in money] [No money for games]