$token » History » Version 3
Per Amundsen, 02/23/2023 07:49 PM
1 | 1 | Per Amundsen | _Added in 1.9.1_ |
---|---|---|---|
2 | |||
3 | *$token(text,N,C)* |
||
4 | |||
5 | Returns the Nth token in text. |
||
6 | |||
7 | _Same as [[$gettok]]._ |
||
8 | |||
9 | 2 | Per Amundsen | _N-N2 can be used to get a range of tokens, both numbers can be negative._ |
10 | _N- can be used to get all tokens from position N._ |
||
11 | |||
12 | 1 | Per Amundsen | *Parameters* |
13 | |||
14 | 3 | Per Amundsen | table(ktable). |
15 | |*Parameter*|*Description*| |
||
16 | | text | The text to tokenize. | |
||
17 | | N | The Nth token to get. | |
||
18 | | C | The "ASCII":http://www.asciitable.com/ value to tokenize by. | |
||
19 | 1 | Per Amundsen | |
20 | *Example* |
||
21 | |||
22 | <pre> |
||
23 | ; Print the 3rd token in 'a.b.c.d.e' |
||
24 | //echo -ag $token(a.b.c.d.e,3,46) |
||
25 | 2 | Per Amundsen | |
26 | ; Print the second to forth token in 'a.b.c.d.e'. |
||
27 | //echo -ag $token(a.b.c.d.e,2-4,46) |
||
28 | |||
29 | ; Print all tokens from the second position. |
||
30 | //echo -ag $token(a.b.c.d.e,2-,46) |
||
31 | 1 | Per Amundsen | </pre> |