11.07.2015 Views

NetEx EFT213 Reference Manual Rel 5.4

NetEx EFT213 Reference Manual Rel 5.4

NetEx EFT213 Reference Manual Rel 5.4

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

String LiteralsA string literal as mentioned earlier, is any quoted string. Quoted strings refer to a string of characters, enclosedin double quotes, from zero to n long, where n. is arbitrarily long depending on the space remaining inthe <strong>NetEx</strong>/eFT input buffer.Below is an example of a string literal used with string substitution and the string function LOWER() (describedon page 82) to define the <strong>NetEx</strong>/eFT prompt as command? with two leading and two trailing spaces:eFT> set input prompt {lower(" COMMAND? ")}This will result in the following prompt, including the two leading and two trailing spaces:command?In order to have embedded double quotes within a string literal, the user must escape each one with a seconddouble quote. The example below shows this:eFT> set input prompt {lower("""Enter a Command:"" ")}The resulting prompt would be:"enter a command: "with a single trailing space.The examples above demonstrate the use of string literals within the SET command. Quoted strings within aTEXT command, however, are taken literally. Therefore, to display the same “enter a command:” with doublequotes using the TEXT command, the following syntax is used:eFT> text "enter a command:"eFT: "enter a command:"String Functions<strong>NetEx</strong>/eFT string functions perform certain predefined tasks and return a string as output. String functionsperform such tasks as comparing two strings, forcing a string to upper/lower case, returning the status of theprevious command, and sleeping for a predetermined amount of time. Some string functions require argumentsand some do not. All arguments passed to a string function must be a numeric constant, a string literal,a string variable, or another string function. For example, the string function lower() takes a single argumentwhich is a string that will be forced to all lower case characters. The following are all valid arguments:lower("sample string")lower(hostname)lower(date())lower(ext(time(),1,5))- a string literal- a variable named hostname- a string function date()- string functions with numeric constants<strong>NetEx</strong>/eFT performs string substitution from the inside out. Therefore, if a string function exists as an argumentto another string function, the innermost string function is executed first, and the resultant string ispassed as an argument to the outer string function. In the example lower(date()) above, the date() functionwould get processed first, then the actual date string would be passed as an argument to lower().The greatest use of string functions comes within <strong>NetEx</strong>/eFT scripts (input files or aliases). Often it is desirableto perform a particular <strong>NetEx</strong>/eFT command based on a certain condition. String functions make this possible.The following is an example of a simple script that tests the results of a command with the status()function and operates accordingly:Page 66 Advanced Local User’s Guide REF-eFT213-R<strong>5.4</strong>-08

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!