Project

General

Profile

$insert » History » Version 3

Per Amundsen, 02/23/2023 01:54 PM

1 1 Per Amundsen
_Added in 1.8.10_
2
3
*$insert(text, token, N)*
4
5 2 Paul Janson
Insert token into text after position N.
6 1 Per Amundsen
7
*Parameters*
8
9 3 Per Amundsen
table(ktable).
10
|*Parameter*|*Description*|
11
| text | Text to insert to. |
12
| token | Token to insert. |
13
| N | Position in text to insert the token after. |
14 1 Per Amundsen
15 2 Paul Janson
Resulting string has N characters of 'text', followed by 'token', followed by the remainder of 'text'
16
17 1 Per Amundsen
*Example*
18
19
<pre>
20
; Insert 'wo' at position 6.
21
//echo -ag $insert(hello rld, wo, 6)
22 2 Paul Janson
//var %string hello rld , %pos 6 , %new wo  | echo -ag $insert(%string, %new , %pos) same as $left(%string,%pos) $+ %new $+ $mid(%string,$calc(1+%pos))
23 1 Per Amundsen
</pre>