簡體   English   中英

在另一個字節數組中查找字節數組並提取 x 字節數

[英]Find byte array inside another byte array and extract x amount of bytes

知道如何在字節數組中找到字節數組嗎?

例子

byte[] array1 = { 101, 21, 92, 1, 92, 0, 132, 0, 22 }
byte[] search = { 21, 92 }

所以使用數組搜索並在 array1 中找到它,然后在搜索數組之后提取 x 字節數,直到達到特定字節,例如,

0, 132, 0, 22

例如提取將在這種情況下

1, 92

來自array1

byte[] array1 = { 101, 21, 92, 1, 92, 0, 132, 21, 0, 22 };
byte[] search = { 21, 92 };
var data = search.Where(a => array1.Contains(a)).ToList();
foreach (var item in data)
{
    Console.WriteLine(item);
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM