SPL Array - Copy arrays


1. Available Util functions for array copy
  1. You should use Util functions to copy arrays.

 



2. Copy arrays
  1. You can copy arrays by using below method.

       Util.ArrayCopy(Array src, Array dest, int length)

  2. Add script as follows.

      
    clear
    
    srcArr = Util.CreateArrayByte(2)
    srcArr[0] = 0x40
    srcArr[1] = 0x41
    
    destArr = Util.CreateArrayByte(2)
    
    Util.ArrayCopy(srcArr, destArr, 2)  
    
    print Util.BytesToHex(destArr)
    
      


  3. Executed result is as follows.




3. Copy range of array
  1. You can copy range of array by using below method.

       Util.ArrayCopy(Array src, int src_index, Array dest, int dest_index, int length)

  2. Add script as follows.

      
    clear
    
    srcArr = Util.CreateArrayByte(4)
    srcArr[0] = 0x40
    srcArr[1] = 0x41
    srcArr[2] = 0x42
    srcArr[3] = 0x43
    
    destArr = Util.CreateArrayByte(4)
    destArr[0] = 0xA0
    destArr[1] = 0xA1
    destArr[2] = 0xA2
    destArr[3] = 0xA3
    
    Util.ArrayCopy(srcArr, 1, destArr, 1, 2)  
    
    print Util.BytesToHex(destArr)
    
      


  3. Executed result is as follows.