Main Content

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

endsWith

string が部分文字列で終了しているかどうかを判別する

R2022b 以降

説明

tf = endsWith(str,substr) は、string str が部分文字列 substr で終了している場合に 1 (true) を返し、そうでない場合に 0 (false) を返します。この演算子は Requirements Table ブロックで使用します。

tf = endsWith(str,substr,IgnoreCase=true) は、大文字小文字を区別せず、strsubstr で終了しているかどうかをチェックします。

すべて展開する

Requirements Table ブロックで、string "Hello, world!" が部分文字列 "world!" で終了しているかどうかをチェックする要件を作成します。

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

This image shows a requirement that outputs whether the string "Hello, world" ends with the substring "world!".

Requirements Table ブロックで、大文字小文字を区別せずに、string "Hello, world!" が部分文字列 "World!" で終了しているかどうかをチェックする要件を作成します。

y = endsWith("Hello, world!","world!",IgnoreCase=true)

This image shows a requirement that outputs whether the string "Hello, world" ends with the substring "World!" regardless of case.

入力引数

すべて展開する

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

例: "Hello"

データ型: string

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

例: "Hello"

データ型: string

制限

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

バージョン履歴

R2022b で導入