Replace x value into y value in string text. Example text='Hello World' x='World', y='Universe' result='Hello Universe'.
Solution Stats
Problem Comments
2 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers80
Suggested Problems
-
Create a square matrix of multiples
496 Solvers
-
1226 Solvers
-
ベクトル [1 2 3 4 5 6 7 8 9 10] の作成
597 Solvers
-
Deleting an element in a matrix
490 Solvers
-
Replace every 3rd element in a vector with 4
264 Solvers
More from this Author37
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
So we can use the ans trick again ?
But we can't use something like :
function text = Replace(text,x,y)
tructruc(text,x,y)
Strange no ?
regexprep doesn't modify directly str
For example :
str='Jean'
regexprep(str,'e','a')
ans='Jaan'
but str is always = 'Jean'