conIns() function in Container X++ Language
Table of Content:
- The conIns() is used to insert one or more elements into a container.
- Syntax: container conIns(container container, int start, anytype element, ...)
- container - The container into which to insert elements.
- start - The position at which to insert elements.
- element - One or more elements to insert, separated by commas.
- Return value: The new container with the inserted elements.
Example:
Code:
static void Container_conInsExample(Args _args) { // container declaration and initialization with 2 values container containerName = ["Welcome", 1202]; str charHolder; ; // conIns() function usage // (Inserts a value into a specific position in the container, index shifted next) // Note: Here Inserting value 299 at 2nd location and shifting the rest to the right! containerName = conIns(containerName, 2, 200); info(strFmt("Container containerName conIns() values are :- %1 , %2, %3", conPeek(containerName, 1), conPeek(containerName, 2), conPeek(containerName, 3))); }
Output:
The above code will produce the following result-
Container containerName conIns() values are :- Welcome , 200, 1202