arg expression function

Returns an argument from a list of HScript-style arguments.

All Usage Examples

See also: argc

Usage

arg(line, argNum)

This function extracts an argument from a line. The example below will extract the time out of the date string returned by the system function. arg is useful for extracting tokens from space delimited strings.

Examples

arg("This returns foobar from this sentence", 2)

Returns the third word from the sentence: foobar.

arg (system(date), 3)

Returns the the fourth word from the date command. This is usually the system time, ie: 15:26:31.

arg("Quoting 'makes this one arg'", 1)

Returns “makes this one arg” as the quoting has transformed that into a single token. Note the quotes are not present in the output.