This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

String Find

Return index of first occurrence of pattern string

  • Library:
  • Simulink / String

Description

The String Find block returns the index of the first occurrence of the pattern string sub in the text string str.

Ports

Input

expand all

String in which to find pattern (sub), specified as a scalar.

Data Types: string

Pattern to be found in string (str), specified as a scalar.

Data Types: string

Output

expand all

Position index of the found pattern, specified as a positive integer scalar.

  • If the block does not find the pattern, it returns -1.

  • If the sub parameter is empty (""), the block returns 1, indicating that it matched the beginning of the searched string.

Data Types: int32

Block Characteristics

Data Types

integer | string

Direct Feedthrough

yes

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Introduced in R2018a