why can't i find string using indexOf()

hi guys.

i have a problem about processing of string

when i receive some packet from sensor via uart port for example, shown by below

why can’t find position of target string in original string?

char arr = { 0xA0,0xA,0x01,0x89, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xCC,
0xA0, 0xA, 0x1, 0x89, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xCC,
0xA0, 0xA, 0x1, 0x89,0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xCC,
0xA0, 0xA, 0x1, 0x89, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xCC };

char arr_rfid_header = {0xA0, 0x0A, 0x01, 0x89};

to use indexOf in String class, converted character set to string class
String strArr="";
for(int i= 0 ; i < sizeof(arr) / sizeof(char);++i)
{
strArr +=arr*;*
}
// A0 0A 01 89
for(int i = 0 ; i < 4; ++i)
str_rfid_header += arr_rfid_header*;*
int in1 = strArr.indexOf(str_rfid_header);
int in2 = strArr.indexOf(str_rfid_header,in1+1);
desired
in1 :0
in2 :12
*result *
in1 : 0
in2 : -1

strArr +=arr[ i ] ; ?

Or has the subscript got lost because you did not use code tags ?

I doubt very much that you can use String (capital S) and I'm sure that the C string functions (lowercase s) will not work.

Your data contains the nul character. You will have to loop through your character array.

memmem?

Look at this description of the String (class) concatenation and look at the number of cases it warns you of unpredictable results. That plus all the anecdotal evidence of bizarre and inexplicable behaviour of the String class in this forum should put you off using it.