beautypg.com

Substr – Visara Master Console Center Scripting Guide User Manual

Page 195

background image

Chapter 5 Script Commands

Scripting Guide

195

SUBSTR

Syntax:

SUBSTR( $String, %Start[, %Count]) ==> $SubStr

Description:

Extract a substring from a character string.

Action:

A substring is extracted from a string expression, beginning with the

specified character position in the string expression and taking the
specified number of characters.

Parameters:

$String. String expression. The character string from which to

extract characters.
%Start. Numeric expression. The starting character position in

String. If Start is positive, the starting position is relative to the
leftmost character in String. If Start is negative, the starting position

is relative to the rightmost character in String. If Start is zero, a

runtime error occurs.
%Count. Numeric expression. Optional. The number of characters to

extract. If Count is greater than the number of characters from Start

to the end of String, the extra is ignored. If Count is not specified,
Count defaults to the number of characters from Start to the end of

String.

Returns:

String value. The specified substring.

Notes:

N/A

Example:

$Var := SUBSTR( $Msg, 4, 3)
$Var := SUBSTR( $First + $Second, 6, 8)

See Also:

ATSTR, FINDSTR, LEFTSTR, REPSTR, RIGHTSTR, STR, SUBSTR,