Automation Engine Script Guide > Ordered by Function > Strings > STR_CUT

STR_CUT, MID, SUBSTR

Script 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 variableA placeholder for a value within a script.

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 scriptA particular Automation Engine object type. 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 functionPre-defined run book template in the Automation Engine. One single step only, e.g. Start Windows Service, Copy file,… 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 userIn the Automation Engine, a user is an instance of a User object, and generally the user is a specific person who works with Automic products. The User object is assigned a user ID and then a set of access rights to various parts of the Automation Engine system and product suite. These access rights come in the form of Automation Engine authorizations and privileges, Decision user roles and EventBase rights and ARA web application object rights. You can manage all these centrally in the ECC user management functions. See also, Unified user management.-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

 


Automic Documentation - Tutorials - Automic Blog - Resources - Training & Services - Automic YouTube Channel - Download Center - Support

Copyright © 2016 Automic Software GmbH