D designer2k2 Member Licensed User Longtime User Apr 23, 2019 #1 Hello, im lost in searching for a way to get this done I have a file, where i need to find 2 byte sequences, and then extract the data between this 2 positions into a new file. This is simple in python: Code: Copy pos1 = data.find(bytes([0x13, 0x43, 0x44, 0x3f]) pos2 = data.find(bytes([0x12, 0x34, 0x3f]) new = data[pos1:pos2-pos1] but in B4A the byte array has no search function? I read the file like this: Code: Copy Dim b as Bytes() b = File.ReadBytes(Dir,Path) Any idea or direction what i can follow up to get this going? greetings, d2k2
Hello, im lost in searching for a way to get this done I have a file, where i need to find 2 byte sequences, and then extract the data between this 2 positions into a new file. This is simple in python: Code: Copy pos1 = data.find(bytes([0x13, 0x43, 0x44, 0x3f]) pos2 = data.find(bytes([0x12, 0x34, 0x3f]) new = data[pos1:pos2-pos1] but in B4A the byte array has no search function? I read the file like this: Code: Copy Dim b as Bytes() b = File.ReadBytes(Dir,Path) Any idea or direction what i can follow up to get this going? greetings, d2k2
DonManfred Expert Licensed User Longtime User Apr 23, 2019 #2 Use bytesbuilder. I guess it should be doable with it. Last edited: Apr 23, 2019 Upvote 1
D designer2k2 Member Licensed User Longtime User Apr 23, 2019 #3 WOA! Thank you DonManfred! https://www.b4x.com/android/forum/t...implifies-working-with-arrays-of-bytes.89008/ With IndexOf and SubArray2 this reads as perfect solution Upvote 0
WOA! Thank you DonManfred! https://www.b4x.com/android/forum/t...implifies-working-with-arrays-of-bytes.89008/ With IndexOf and SubArray2 this reads as perfect solution