Main Content

本页采用了机器翻译。点击此处可查看英文原文。

extractAfter

提取 Requirements Table模块中位置后的子字符串

自 R2022b 起

描述

示例

newStr = extractAfter(str,subStr) 返回 str 中在子字符串 subStr 最后一次出现之后开始的子字符串。

示例

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

示例

全部展开

Requirements Table模块中,创建一个需求,返回子字符串 "Hello, " 之后的字符串 "Hello, world!" 中的字符。输出为 "world!"

y = extractAfter("Hello, world!","Hello, ")

This example shows a requirement that extracts the characters after the substring "Hello, " in the string "Hello, world!".

Requirements Table模块中,创建一个需求,返回字符串 "Hello, world!" 的第七个字符后的子字符串。输出为 "world!"

y = extractAfter("Hello, world!",7)

This example shows a requirement that extracts the substring after the 7th character in the string "Hello, world!".

输入参数

全部展开

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

示例: "Hello"

数据类型: string

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

示例: "Hello"

数据类型: string

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

数据类型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

输出参量

全部展开

输出字符串,以字符串标量形式返回。

限制

  • 该运算符不支持使用Simulink.Bus对象字段。

版本历史记录

在 R2022b 中推出