Main Content

extractAfter

Extract substring after position in Stateflow chart

Since R2021b

Description

example

newStr = extractAfter(str,subStr) returns the substring of str that begins after the first occurrence of the substring subStr. If subStr occurs multiple times in str, then newStr is str from the first occurrence of subStr to the end.

example

newStr = extractAfter(str,pos) returns the substring of str that begins after the character position pos.

Note

The extractAfter operator is not supported in Stateflow® charts that use C as the action language. For similar functionality, use substr.

Examples

expand all

Extract substring "world!" from a longer string.

str = "Hello, world!";
newStr = extractAfter(str,"Hello, ");

Stateflow chart that uses the extractAfter operator in a state.

Extract substring "world!" from a longer string.

str = "Hello, world!";
newStr = extractAfter(str,7);

Stateflow chart that uses the extractAfter 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.

Limitations

Version History

Introduced in R2021b