Main Content

erase

Delete substrings within strings in Stateflow chart

Since R2021b

Description

newStr = erase(str,substr) deletes instances of the substring substr that occur in the string str.

example

Note

The erase operator is not supported in Stateflow® charts that use C as the action language.

Examples

expand all

Delete a substring to form the string "Hello!"

str = "Hello, world!";
newstr = erase(str,", world");

Stateflow chart that uses the erase operator in a state.

Input Arguments

expand all

Input string, specified as a string scalar. Enclose literal strings with double quotes.

Example: "Hello"

Substring, specified as a string scalar. Enclose literal strings with double quotes.

Example: "Hello"

Limitations

  • This operator does not support the use of Stateflow structure fields or messages. For more information about structures in Stateflow, see Access Bus Signals.

Version History

Introduced in R2021b