MyChat Scripts Engine: Insert
Inserting a substring into a string at the specified position.
Syntax
procedure Insert(var sOriginal: string; sWhatInsert: string; iFrom: integer);
Parameters and return values
Parameter |
Type |
Value |
sOriginal |
string |
source string; |
sWhatInsert |
string |
substring to insert into the source string; |
iFrom |
integer |
position, where you should insert the substring, must be 0. |
Function result
String value with the source string at the specified position.
Example
const
sInsertWhat = 'I want it all,';
sInsertTo = 'and I want it now.';
var
s: string;
i: integer;
begin
s := sInsertTo;
mLogScript('Original string: "' + s + '"', '');
for i := 1 to 3 do
insert(sInsertWhat + ' ', s, 1);
mLogScript('Result string: "' + s + '"', '');
end.
Script work result
[14:55:00] (Log "Insert"): Original string: "and I want it now."
[14:55:00] (Log "Insert"): Result string: "I want it all, I want it all, I want it all, and I want it now."