Get Sub String

This is a pre-built Action located under the @Generic Element. The functionality of this Action in Avo Assure is to extract a specific part of the input text based on the given index or range. The extracted portion is stored in a dynamic variable.

Syntax

Input Value: <string>;<index OR range>

Argument
Description

<string > (Required)

Provide the full string from which you want to extract a part.

<index OR range > (Required)

Provide the position or range of characters you want to extract.

Note:

  • The index value starts from the 0th index till Nth index.

  • Index: The extraction starts from the given index and continues until the end of the string.

  • Range: Use the format StartIndex–EndIndex. The extraction starts from the StartIndex and stops just before the EndIndex. To include the last character, increase the EndIndex by 1 (total range+1).

Output Value: <Dynamic Varibale>;<Dynamic Variable>(Optional)

Argument
Description

<Dynamic Variable> (Required)

This dynamic variable stores a specific portion of a string.

<Dynamic Variable> (Optional)

This dynamic variable stores the status as True or False.

Example 1: Extracting a Substring from a String Using Index Value

In this example, we explain how to extract a part of a string starting from a specific index in Input Value.

  • Action: Get Sub String

  • Input Value: Software Engineer;4

    • The first argument (Software Engineer) specifies the main string,

    • The second argument (4) specifies the starting index from which the substring is extracted.

  • Output Value: {Sub string}

    • The extracted substring (ware Engineer) is stored in this {Sub string} dynamic variable for further use.

    • If the second output variable is defined, it stores the action status with the following possible values:

      • True: If the substring is successfully extracted.

      • False: If the input value is empty or invalid.

  • Logical Explanation: The Get Sub String action fetches the value from the Input Value column (Software Engineer;4) and extracts the substring starting from the specified index (4). For the given input, the resulting substring is (ware Engineer). The extracted substring is stored in the {Sub string} variable.

Example 2: Extracting a Substring from a String Using a Range Value

In this example, we explain how to extract a part of a string using a specific range in Input Value.

  • Action: Get Sub String

  • Input Value: Software Engineer;9–17

    • The first argument (Software Engineer) specifies the main string,

    • The second argument (9–17) defines the range of characters to extract.

  • Output Value: {Sub string}

    • The extracted substring (Engineer) is stored in this {Sub string} dynamic variable for further use.

    • If the second output variable is defined, it stores the action status with the following possible values:

      • True: If the substring is successfully extracted.

      • False: If the extraction fails due to an invalid range or input.

  • Logical Explanation: The Get Sub String action fetches the value from the Input Value column (Software Engineer;9-17) and extracts the substring based on the specified range (9–17). For the given input string, the resulting substring is (Engineer). The extracted substring is stored in the {Sub string} variable.

Knowledge Bites:

Here are some examples of different string scenarios:

String
Input Value
Result

Text Strings

index: Automation;4

OR

range: Automation;3-10

index: mation

OR

range: omation

Numeric Strings

index: 12345678;4

OR

range: 12345678;3-10

index: 5678

OR

range: 45678

Special Character

index: [email protected];4

OR

range: [email protected];3-10

index: domain.com

OR

range: @domain

Alphanumeric strings

index: ID2025;4

OR

range: ID2025;3-6

index: 25

OR

range: 025

Last updated

Was this helpful?