Main Content

extractAfter

Extract substring after specified positions

Description

example

newStr = extractAfter(str,pat) extracts the substring that begins after the substring specified by pat and ends with the last character of str. If pat occurs multiple times in str, then newStr is str from the first occurrence of pat to the end.

example

newStr = extractAfter(str,pos) extracts the substring that begins after the position specified by pos and ends with the last character of str.

Note

Only Stateflow® charts that use MATLAB® as the action language support the extractAfter operator.

Examples

expand all

Select the text that occurs after a substring.

h = "Hello, world!"
pat = "Hello, "
x = extractAfter(h, pat)

Stateflow chart that uses the extractAfter operator in a state.

Results from stateflow chart that uses the extractAfter operator in a state.

Select the text that occurs after a position.

h = "Hello, world!"
x = extractAfter(h, 7)

Stateflow chart that uses the extractAfter operator in a state.

Results from stateflow chart that uses the extractAfter operator in a state.

Limitations

Introduced in R2021b