Let (FindString)

Top  Previous  Next

S

A

W

WS

ü

ü

The following commands have been implemented in EMUEScript exactly as they are implemented in OLIE™:

In addition, EMUEScript has implemented enhancements to the features and functions of this command.

 

Note: The Let command is only valid for assigning numeric values to variables.  The Copy command is used to assign literal string to variables.

 

Syntax - FindString

Let <variable name> = FINDSTRING <String to be searched> <String to search for>

       Where:

       <variable name> is the user defined name that is assigned to the variable.

       <String to be searched> is a literal string or a variable that contains a literal string.

       <String to search for> is a literal string or a variable that contains a literal string.

 

Description:

The FindString enhancement to the Let command is used to find the starting location of one literal string inside of another literal string.   The integer value, stored as the <variable name>, is determined by the number of character positions from the leftmost character of the <String to be searched> to the character position of the <String to be searched>, where the first position of the <String to search for> is located.  If the <String to search for> cannot be found inside the <String to be searched>, 0 will be stored as the <variable name>.  FindString is not case-sensitive.

 

Note: The FindString variation of the Let command provides functionality similar to the INSTR command found in other languages.  This function simplifies the parsing of strings, and can be used to parse raw reports.

Note: If both the <String to be searched> and the <String to search for> are the empty string (""), 0 will be stored as the <variable name>.  If the  <String to search for> is the empty string ("") and the <String to be searched> is not, 1 will be stored as the <variable name>.  

 

Sample:

       This sample shows how to separate the first name and last name values that are in one field in a file, and separates them placing a comma between them.

rem Retrieve the entire name from the file

Copy wholename file 25 26

rem find the comma

Let commapos = findstring wholename ","

rem text before the comma is the last name.

Let lastnamelength = commapos 1

rem calculate the number of characters remaining after the comma

Let firstnamelength = 26 - commapos

rem Calculate the starting character position of the first name

Let firstnamestart = commapos + 1

rem Using the calculated start positions and lengths, copy the strings into variables

Copy lastname wholename 1 lastnamelength

Copy firstname wholename firstnamestart firstnamelength