$token (parse-spec) function
Return the value produced by parse-spec as a single word, where the result of the parse-spec value has all spaces substituted with a _ (underscore) character. This makes a single space delimited word out of a series of words, 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.
This function might 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.
Target string | Parse expression | Return value |
---|---|---|
This is a test
| $token( $delim(eol, 1)) | This_is_a_test The $delim() function parses all words (delimited by the end of line). The result has underscores.
|
Test - DBID: 100 - OBID: 200 - Test | $token( $concat(dbid: *, obid: *)) | 100_200 The $token() function parses dbid and obid values. The result has underscores. |
My user: Bill xxx | $token(user: *) | Bill The $token() function is replaced by the parsed value without modification. |
Related topic