# LGF_ExtractStringFromCharArrayAdv (FC / 1.1.0)

Overview

Author: Siemens Online Support

## Short description

The function extracts a String specified by a text before and after from an array of characters with extended options.

### Block Interface

| LGF_ExtractStringFromCharArrayAdv (FC) |
--- | --- | ---
String |  |  | textBefore |  | Ret_Val |  |  | Word
String |  |  | textAfter |  | extractedString |  |  | String
Bool |  |  | includeBeforeAfter |  | position |  |  | DInt
DInt |  |  | startPos |  | length |  |  | Int
|  |  |  |  | status |  |  | Word
Variant |  |  | searchIn |  |  | Variant

### Input parameter

Identifier | Data type | Description
--- | --- | ---
textBefore | String | Text in front of the characters which has to be extracted
textAfter | String | Text behind the characters which has to be extracted
includeBeforeAfter | Bool | TRUE: `textBefore` and `textAfter` are included in the extracted string
startPos | DInt | Position within the array to start search from (index zero based)

### Output parameter

Identifier | Data type | Description
--- | --- | ---
Ret_Val | Word | Return value: 16#0000-16#7FFF: Status of the FB 16#8000-16#FFFF: Error identification (see following Table)
extractedString | String | Extracted string
position | DInt | Position (index) within the array where text begins (index zero based)
length | Int | Length of text that was extracted
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_TEXT_FOUND Successful, start text and end text were found
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`
16#9001 | WARNING_ONLY_START Unsuccessful, only start text was found, extracted String is filled with characters after start text
16#9002 | WARNING_NOTHING_FOUND Unsuccessful, neither text was found

## 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