Main Content

erase

Delete substrings within strings in Requirements Table block

Since R2022b

Description

example

newStr = erase(str,substr) deletes instances of the substring substr that occur in the string str. Use this operator in the Requirements Table block.

Examples

expand all

In a Requirements Table block, create a requirement that erases the substring ", world" from the string "Hello, world!".

y = erase("Hello, world!",", world")

This example shows a requirement that erases the substring ", world" from the string "Hello, world!".

Input Arguments

expand all

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

Example: "Hello"

Data Types: string

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

Example: "Hello"

Data Types: string

Output Arguments

expand all

Output string, returned as a string scalar.

Limitations

  • This operator does not support the use of Simulink.Bus object fields.

Version History

Introduced in R2022b

See Also