User's Guide

SUBSTR

Return a substring of a TAE variable

Function:

Given a TAE variable name, this function will get the value of a specified substring and set a new TAE variable to that value.

Parameters:

STRING
Input string. The input string that the substring will be extracted from.

START
Starting position. The starting position in the string where the substring will be extracted.

LENGTH
Length of substring. The number of characters to extract from the input string. If LENGTH is zero (0), all characters from the start character to the end of the input string are extracted.

OUT
Output string. The substring of the input string. Its value is determined by: OUT = STRING(START:LENGTH).

Examples:

  1. LAS> substr string="test string" start=8 length=4 out=temp

    The local variable temp will have the value of "ring".

Description/Algorithm:

A system-specific routine is called to perform the extraction, and the output value is returned to the local variable specified in OUT.

Nonfatal Error Messages:

    None.

Fatal Error Messages:

  1. [substr-fatal] Illegal substring specification

    The starting character plus the length specified exceeds the length of the string. Respecify the values and rerun the program.

User Notes:

  1. The program cannot process strings that contain either double or single quotes.

  2. On UNIX systems, if the string contains a '$', it is assumed to be an environment variable, and a substring of the translated value will be returned.