uCon HomePage

Script Cmd: STRING


STRING  [-a] {sub-command} {string_here} [args] ...

This command is useful for parsing or querying a string. It supports a variety of different sub-commands that will perform some type of query or parse on the string. The result is placed in the shell variable "STRING".

Options:

-a    used exclusively with the checksum/crc sub-commands, this tells the command to treat the string as ASCII-coded-hex.

Current sub-commands supported:

firstchar-
Syntax: STRING firstchar {string}
Populate the STRING shell variable with the first character of the string specified.
lastchar-
Syntax: STRING lastchar {string}
Populate the STRING shell variable with the last character of the string specified.
length-
Syntax: STRING length {string}
Populate the STRING shell variable with the length of the string specified.
strstr-
Syntax: STRING strstr {needle} {haystack}
Populate STRING with offset into haystack if found; else populate STRING with "NULL".
precut-
Syntax: STRING precut {string} ##
Populate the STRING shell variable the result of cutting off the first ## characters from the specified string.
postcut-
Syntax: STRING postcut {string} ##
Populate the STRING shell variable the result of cutting off the last ## characters from the specified string.
token-
Syntax: STRING token {string} {N}
Populate the STRING shell variable with the 'Nth' token in the string (where N starts at 1).  If token is not found, the STRING variable is not populated.  This requires that 'string' be enclosed within double quotes so that the tokens within it are not processed by the command line interpreter.
tolower-
Syntax: STRING tolower {string}
Populate the STRING shell variable the result of converting all characters in the specified string to lower case.
toupper-
Syntax: STRING toupper {string}
Populate the STRING shell variable the result of converting all characters in the specified string to upper case.

In addition to the sub-commands listed above, all of the checksum/crc algorithms as listed in the Config->Miscellaneous  Csum Method drop-down list support applying the specified checksum/crc algorithm to the string.  The -a option tells this sub-command to treat the string as ASCII-coded-hex.