Main Content

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

strip

string から先頭および末尾の文字を削除する

R2022b 以降

説明

newStr = strip(str) は、string str の先頭および末尾から連続した空白文字を削除します。この演算子は Requirements Table ブロックで使用します。

newStr = strip(str,side) は、side で指定した側から連続した空白文字を削除します。

newStr = strip(___,stripCharacter) は、stripCharacter で指定した文字を除去します。上記の構文の任意の入力引数を使用できます。

すべて展開する

Requirements Table ブロックで、string に含まれている先頭と末尾の空白文字を削除する要件を作成します。

y = strip("    Hello, world!      ")

This example shows a requirement that deletes the leading and trailing space characters in the string " Hello, world! ".

Requirements Table ブロックで、string に含まれている先頭の空白文字のみを削除する要件を作成します。

y = strip("    Hello, world!      ","left")

This example shows a requirement that deletes only the leading space characters in the string " Hello, world! ".

Requirements Table ブロックで、string の先頭にある連続した文字 e を削除する要件を作成します。

y = strip("eeeeeeHello, world!      ","left","e")

This example shows a requirement that deletes only the leading space characters in the string "eeeeeeHello, world! ".

入力引数

すべて展開する

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

例: "Hello"

データ型: string

string で除去する側。"left""right"、または "both" として指定します。

データ型: string

削除する文字。string スカラーとして指定します。

データ型: string

出力引数

すべて展開する

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

制限

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

バージョン履歴

R2022b で導入

参考