Main Content

extractAfter

Extract substring after position

Description

example

newStr = extractAfter(str,subStr) returns the substring of str that begins after the last occurrence of the substring subStr.

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