From WikiChip
$puttok identifier - mIRC
< mirc‎ | identifiers

$puttok replaces the Nth $asc(C)-delimited token in a list.

Synopsis[edit]

$puttok(<LIST>,<Token Data>,<N>,<C>)

Parameters[edit]

LIST: - Text list delimited by a character into tokens
Token Data: - Replacement text which overwrites the existing Nth token
N: - The token number to be overwritten
C: - The $asc() value which splits TEXT into tokens

If N is negative, returns tokens relative to the last token. -1 is the last token, -2 is next-to-last token, etc.

Properties[edit]

None

Examples[edit]

//echo -a $puttok(a-b-c-d-e-f,TEST,3,46))
; returns a-b-TEST-d-e-f

Shows the unchanged path with the filename changed to TEST.TXT:

//echo -a $puttok($mircexe,TEST.TXT,-1,92))
//echo -a $puttok(x11xx33X44x55x66x,TEST,3,120)
; returns 11x33X44xTESTx66
; because leading/trailing/duplicate delimiters are removed before evaluating <LIST>. $chr(120) is lower-case x so the capital X is not a delimiter.

Note: Unlike CSV format, if C=44 to delimit with commas, double-quotes around filename containing a comma does not allow the entire filename to be a single token. If you want $filename to be a token in a comma-delimited list of tokens, you should use $replace to change the comma in the filename into another character that cannot appear in the filename before adding as a token, then use $replace on the extracted token to restore any comma(s).

Compatibility[edit]

Added: mIRC v5.3
Added on: 13 Dec 1997
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See also[edit]

[Expand]
v · d · e mIRC identifier list