Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

extractAfter

提取指定位置后的子字符串

自 R2021b 起

描述

示例

newStr = extractAfter(str,subStr) 返回 str 的子字符串,该子字符串在子字符串 subStr 的第一次出现后开始。如果 subStrstr 中多次出现,则 newStrstr 中从 subStr 第一次出现的位置到结束的内容。

示例

newStr = extractAfter(str,pos) 返回从字符位置 pos 后开始的 str 的子字符串。

注意

使用 C 语言作为动作语言的 Stateflow® 图不支持 extractAfter 运算符。要获得类似的功能,请使用 substr

示例

全部展开

从较长的字符串中提取子字符串 "world!"

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

Stateflow chart that uses the extractAfter operator in a state.

从较长的字符串中提取子字符串 "world!"

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

Stateflow chart that uses the extractAfter operator in a state.

输入参数

全部展开

输入字符串,指定为字符串标量。用双引号将文字字符串引起来。

示例: "Hello"

子字符串,指定为字符串标量。用双引号将文字字符串引起来。

示例: "Hello"

字符位置,指定为正整数。

限制

版本历史记录

在 R2021b 中推出