Insert

Insere um elemento no array para uma posição específica.

bool  Insert(
   string  element,     // Element to insert
   int     pos          // Position
   )

Parâmetros

element

[in] O valor do elemento para ser inserido no array

pos

[in] Posição no array para inserir

Valor do Retorno

verdadeiro se com sucesso, falso - não pode inserir o elemento.

Exemplo

//--- example for CArrayString::Insert(string,int)
#include <Arrays\ArrayString.mqh>
//---
void OnStart()
  {
   CArrayString *array=new CArrayString;
   //---
   if(array==NULL)
     {
      printf("Object create error");
      return;
     }
   //--- insert elements
   for(int i=0;i<100;i++)
     {
      if(!array.Insert(IntegerToString(i),0))
        {
         printf("Insert error");
         delete array;
         return;
        }
     }
   //--- use array
   //--- . . .
   //--- delete array
   delete array;
  }