Inserts an element into an SRP List at the given index position.

Syntax

SRP_List_InsertAt(Handle, Index, Element)

Parameters

ParameterDescription
HandleHandle to an existing SRP List (REQUIRED)
IndexThe position within the SRP List at which the element will be inserted (REQUIRED)
ElementThe value to insert into the SRP List (REQUIRED)

Remarks

The SRP_List_InsertAt method inserts a value into an SRP List at the given position. Unlike the OI Insert method, passing an index of -1 will _not_ add the element to the end of the array. To perform an add, you need to SRP_List_Add. The reason is speed. In all other ways, however, the SRP_List_InsertAt method works just like the OI Insert function.

IMPORTANT: You should always release the handle to an SRP List when you no longer need it by calling SRP_List_Release.

Examples

// Create the list
Handle = SRP_List_Create()

// Insert several elements
SRP_List_InsertAt(Handle, 1, "ABC")
SRP_List_InsertAt(Handle, 10, "DEF")
SRP_List_InsertAt(Handle, 5, "EFG")

// Convert the SRP List into a normal list
List = SRP_List_GetVariable(Handle, ",")

// List = "ABC,,,,EFG,,,,,DEF"

// Play nice with memory
SRP_List_Release(Handle)
  • No labels