Main Content

insertAfter

Insert string after substring in Stateflow chart

Since R2021b

Description

newStr = insertAfter(str,subStr,new) inserts the string new into the string str after the substring subStr. insertAfter inserts new after every occurrence of subStr.

example

newStr = insertAfter(str,pos,new) inserts new into str after the character position pos.

example

Note

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

Examples

expand all

Insert text to form the string "Hello there, world!".

str = "Hello, world!";
newStr = insertAfter(str,"Hello"," there");

Stateflow chart that uses the insertAfter operator in a state.

Insert text to form the string "Hello there, world!".

str = "Hello, world!";
newStr = insertAfter(str,5," there");

Stateflow chart that uses the insertAfter 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"

Character position, specified as a positive integer.

New 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

Go to top of page