Main Content

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

insertAfter

在子字符串后插入字符串

自 R2021b 起

描述

示例

newStr = insertAfter(str,subStr,new) 将字符串 new 插入到字符串 str 中的子字符串 subStr 之后。insertAfter 在出现的每个 subStr 之后都插入 new

示例

newStr = insertAfter(str,pos,new)new 插入到 str 中的字符位置 pos 之后。

注意

使用 C 语言作为动作语言的 Stateflow® 图不支持 insertAfter 运算符。

示例

全部展开

插入文本以形成字符串 "Hello there, world!"

str = "Hello, world!";
newStr = insertAfter(str,"Hello"," there");

Stateflow chart that uses the insertAfter operator in a state.

插入文本以形成字符串 "Hello there, world!"

str = "Hello, world!";
newStr = insertAfter(str,5," there");

Stateflow chart that uses the insertAfter operator in a state.

输入参数

全部展开

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

示例: "Hello"

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

示例: "Hello"

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

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

示例: "Hello"

限制

版本历史记录

在 R2021b 中推出