# LGF_FindStringInCharArray (FC / 1.1.0)

Overview

Author: Siemens Online Support

## Short description

The function searches for a specified String within an array of characters.
Returning the position of the String in the Array, if the string is not found the return value is `-1`.

### Block Interface

| LGF_FindStringInCharArray (FC) |
--- | --- | ---
String |  |  | searchFor |  | Ret_Val |  |  | DInt
DInt |  |  | startPos |  | status |  |  | Word
Variant |  |  | searchIn |  |  | Variant

### Input parameter

Identifier | Data type | Description
--- | --- | ---
searchFor | String | Text that is searched for
startPos | DInt | Position within the array to start search from (index zero based)

### Output parameter

Identifier | Data type | Description
--- | --- | ---
Ret_Val | DInt | Position (index) of the first character of the text that is searched for within the input array (index zero based). Return `-1` if nothing found.
status | Word | 16#0000-16#7FFF: Status of the FB 16#8000-16#FFFF: Error identification (see following Table)

### In/Out parameter

Identifier | Data type | Description
--- | --- | ---
searchIn | Variant | Array of Character or Byte to search in

### Status & Error codes

Code / Value | Identifier / Description
--- | ---
16#0000 | STATUS_NO_ERROR Status: Execution finished without errors
16#8200 | ERR_NO_ARRAY Error: No array of Char or Byte is present at the input `searchIn`

## Change log

Version & Date | Change description
--- | ---
| 1.0.0 | Siemens Online Support
| 01.04.2019 | First released version (LHttp)
| 1.1.0 | Siemens Online Support
| 10.06.2022 | Adaption and integration into LGF