From MiniScript Wiki
Jump to navigation Jump to search

insert inserts a new element into a string or list.

See also: push; remove


Parameter Name Default Value Meaning
self string or list sequence to insert into
index number position at which to insert the new item
value any element to insert at the specified index

Usage Notes

In the case of a list, the list is both modified in place and returned. Strings are immutable, so in that case the original string is unchanged, but a new string is returned with the value inserted.


"Hello".insert(2, 42)		// returns "He42llo"