Delete substrings within strings
deletes instances of the substring
newStr = erase(
substr that occur in the string
erase operator is not supported in Stateflow® charts that use C as the action language.
Erase Substring from a String
Delete a substring to form the string
str = "Hello, world!"; newstr = erase(str,", world");
str — Input string
Input string, specified as a string scalar. Enclose literal strings with double quotes.
substr — Substring
Substring, specified as a string scalar. Enclose literal strings with double quotes.
This operator does not support the use of Stateflow structure fields or messages. For more information about structures in Stateflow, see Access Bus Signals Through Stateflow Structures.
Introduced in R2021b