STR_CUT, MID, SUBSTR

ScriptEigener Objekttyp in der Automation Engine Functions: It copies characters of a string.

Syntax

STR_CUT(String, Start, [Length])
MID
(String, Start, [Length])
SUBSTR
(String, Start, [Length])

Syntax

Description/Format

String

An alphanumeric string.
Format: script literal or script variable

Start

The start position for the part that should be copied.
Format: number without quotation marks or script variable

Length

The number of characters that should be copied.
Format: number without quotation marks or script variable


Return code

A part of a string.

Comments

These script functions all serve the same purpose. They copy characters from a given String. Length is an optional parameter - not specifying it means that all characters until the end of the String are returned.

The string itself remains unchanged. 

Examples

In the first example, the script function returns "CD". The result of the second example is "CDEFGH" - all characters until the end of the string are included.

:SET &STRING# = MID("ABCDEFGH",3,2)

:SET &STRING# = SUBSTR("ABCDEFGH",3)

The following example uses the script function SUBSTR to split a user-defined term. The first three characters are assigned to the first script variable and the last character to the second script variable.

:READ &TABNAME#, "04", "Please specify table name xxxy"
:
SET &TABPRE# = SUBSTR(&TABNAME#,1,3)
:
SET &TABSUF# = SUBSTR(&TABNAME#,4,1)

See also:

Script element Description

STR_SUBSTITUTE

It replaces characters or strings within a string.
STR_CAT It combines two strings to a new string.

Script Elements - Strings

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by function