Substring

The Substring function returns a substring from a specified string by using index positions.

Index positions start at 0.

Syntax

The Substring function has the following syntax:

String = Substring(Expression, Start, End)

Parameters

The Substring function has the following parameters.

Table 1. Substring function parameters

Parameter

Format

Description

Expression

String

String to search for the substring.

Start

Integer

Starting character position of the substring.

End

Integer

Ending character position of the substring, plus one.

Return value

The substring returned by index positions.

Example

The following example shows how to return a substring using index positions.

MyString = "This is a test.";
MySubstring = Substring(MyString, 0, 4);
Log(MySubstring);

This example prints the following message to the policy log:

Parser Log: This