$puttok » History » Version 2
Per Amundsen, 02/25/2017 04:07 PM
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ |
|---|---|---|---|
| 2 | |||
| 3 | *$puttok(text,token,N,C)* |
||
| 4 | |||
| 5 | Overwrites the Nth token in text with a new token. |
||
| 6 | |||
| 7 | 2 | Per Amundsen | _N-N2 can be used to get a range of tokens, both numbers can be negative._ |
| 8 | _N- can be used to get all tokens from position N._ |
||
| 9 | |||
| 10 | 1 | Per Amundsen | *Parameters* |
| 11 | |||
| 12 | text - The text to tokenize. |
||
| 13 | token - Token to put. |
||
| 14 | N - The Nth token to replace. |
||
| 15 | C - The "ASCII":http://www.asciitable.com/ value to tokenize by. |
||
| 16 | |||
| 17 | *Example* |
||
| 18 | |||
| 19 | <pre> |
||
| 20 | 2 | Per Amundsen | ; Replace the second token with 'e'. |
| 21 | 1 | Per Amundsen | //echo -ag $puttok(a.b.c.d,e,2,46) |
| 22 | 2 | Per Amundsen | |
| 23 | ; Print the second to third token to 'e'. |
||
| 24 | //echo -ag $puttok(a.b.c.d,e,2-3,46) |
||
| 25 | |||
| 26 | ; Replace all tokens from position 2 to 'e'. |
||
| 27 | //echo -ag $puttok(a.b.c.d,e,2-,46) |
||
| 28 | 1 | Per Amundsen | </pre> |