Main Content
strrep
Description
replaces instances of the substring newStr
= strrep(str
,old
,new
)old
that occur in the string
str
with the substring new
. Use this operator in
the Requirements
Table block.
Examples
Input Arguments
Output Arguments
Limitations
This operator does not support the use of
Simulink.Bus
object fields.
Algorithms
The strrep
operator replaces overlapping substrings. For example,
strrep("abc 2 def 22 ghi 222 jkl 2222","22","*")
returns "abc 2
def * ghi ** jkl ***"
. To replace only sequential substrings, use replace
. For more information, see Replace Repeated Pattern.
Version History
Introduced in R2022b