$token (parse-spec) function


This function returns the value produced by parse-spec as a single word, where the result of the parse-spec value has all spaces substituted with an underscore ( _ ) character. This makes a single-space delimited word out of a series of words. The return value can be useful when using functions such as $delim(), $concat(), and $message(), when a single word output of these functions is required. If the parse-spec returns a single word value, then this function simply passes back the value and performs no other action. 

Note

This is the default behavior of the $maplist() function, which has an implicit $token() function wrapping around the input parse specification. The results of that parse specification can match the first column of a list.

This function can be useful with the CPars-exe command line utility, or for any special cases where a single word is required (as opposed to multiple words), but otherwise has limited use.

The following examples show target strings, parse expressions, and return values:

Target string

Parse expression

Return value

This is a test

 

$token ($delim(eol, 1))

This_is_a_test

Explanation: The $delim() function parses all words (delimited by the end of line) and adds underscore characters between the values.

Test - DBID: 100 - OBID: 200 - Test

$token ($concat(dbid: *, obid: *))

100_200

Explanation: The $token() function parses dbid and obid values and adds an underscore character between the values.

My user: Bill xxx

$token (user: *)

Bill

Explanation: The $token() function is replaced by the parsed value without modification.

Related topic

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*