insert_nth()

Returns a new list with an inserted item, given an index into the list, an existing list and an item to insert into the list.

Syntax:

insert_nth(index, list, listItem);

where

index is an integer index into list. If index = list length, then NULL is returned.

list is the list to insert the item into.

listItem is the item to insert.

Example:
decl x = list(1,2,3,4,5);
decl y;
y = insert_nth(3,x,10);
fputs(stdout, identify_value(y)); // output: list(1,2,3,10,4,5)
fputs(stdout, identify_value(x)); // output: list(1,2,3,4,5)
y = insert_nth(0,x,10);
fputs(stdout, identify_value(y)); // output: list(10,1,2,3,4,5)
y = insert_nth(5,x,10);
fputs(stdout, identify_value(y)); // output: list(1,2,3,4,5,10)
y = insert_nth(7,x,10);
fputs(stdout, identify_value(y)); // output: NULL
y = insert_nth(-1,x,10);
fputs(stdout, identify_value(y)); // output: NULL

Where Used:

Measurement Expressions (Data Display equations and Schematic MeasEqns), Schematic, Layout, Simulation, GUI

 

Privacy Statement  | Terms of Use  | Legal | Contact Us  | © Agilent 2000-2008 

Contents
Additional Resources