メインコンテンツ

extractAfter

Requirements Table ブロック内の位置の後にある部分文字列を抽出する

R2022b 以降

説明

newStr = extractAfter(str,subStr) は、部分文字列 subStr の最後の出現箇所の後から始まる、str の部分文字列を返します。

newStr = extractAfter(str,pos) は、文字位置 pos の後から始まる、str の部分文字列を返します。

すべて展開する

Requirements Table ブロックで、string "Hello, world!" 内の部分文字列 "Hello, " の後にある文字列を返す要件を作成します。出力は "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 ブロックで、string "Hello, world!" の 7 番目の文字の後にある部分文字列を返す要件を作成します。出力は "world!" です。

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

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

入力引数

すべて展開する

入力 string。string スカラーとして指定します。リテラル文字列は二重引用符で囲みます。

例: "Hello"

データ型: string

部分文字列。string スカラーとして指定します。リテラル文字列は二重引用符で囲みます。

例: "Hello"

データ型: string

文字の位置。正の整数として指定します。

データ型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

出力引数

すべて展開する

出力 string。string スカラーとして返されます。

制限

  • この演算子では Simulink.Bus オブジェクト フィールドの使用はサポートされません。

バージョン履歴

R2022b で導入