| |
SPL Array - Insert value into byte[] array
1. Insert value of ushort type into byte[] array
- You can insert value of ushort type into array by using below method.
Util.InsertValueIntoArray(byte[] data, int pos, int size, uint val)
- Add script as follows.
| |
clear
srcArr = Util.CreateArrayByte(5)
srcArr[0] = 0xA0
srcArr[1] = 0xA1
srcArr[2] = 0xA2
srcArr[3] = 0xA3
srcArr[4] = 0xA4
val = 255
Util.InsertValueIntoArray(srcArr, 1, 2, val)
print "srcArr -> " + Util.BytesToHex(srcArr)
| |
|
|
|
|
- Executed result is as follows.
2. Insert value of uint type into byte[] array
- You can insert value of ushort type into array by using below method.
Util.InsertValueIntoArray(byte[] data, int pos, int size, uint val)
- Add script as follows.
| |
clear
srcArr = Util.CreateArrayByte(5)
srcArr[0] = 0xA0
srcArr[1] = 0xA1
srcArr[2] = 0xA2
srcArr[3] = 0xA3
srcArr[4] = 0xA4
val = 0x01020304
Util.InsertValueIntoArray(srcArr, 1, 4, val)
print "srcArr -> " + Util.BytesToHex(srcArr)
| |
|
- Executed result is as follows.
|