Array locator method 'find_index' not working on a string queue

In reply to cgales:

In reply to Dev_Engine:
There are some inconsistencies in your question, so some clarification is needed.
The string data type is an ordered collection of characters. You state that your data is “amb124hk2k3b2jb42223fmf…”, which would be a single string. An queue of strings would be multiple strings, not individual characters.
You don’t show the output of your module ‘image_tests’, so it is difficult to determine if your connections are correct.
The find_index() function will not search each string. Searching for “b”, or any other single character, won’t work. The function will only match the entire string.
Please check your data types and provide clarifying information.

Thanks for replying. This is the first module ‘image_tests.sv’:


module image_tests(arr);
output string arr[$];

string char;
int file;
always_comb
begin
    file = $fopen("./donald.txt","r"); // Input file that is basically a hex dump of a jpeg image
    
    while(!$feof(file))
    begin
        char = $fgetc(file); //My simulator doesn't support $readmemh so I had to use this
        arr.push_back(char);
        
    end
    foreach (arr[i])
        begin
        if(arr[i] == "\n") //remove newline characters
        begin
            arr.delete(i);
        end
        $display("Array value = %s at index %d",arr[i],i); //Display each character of the queue with a separate index for each.
        end
    
    
    
    $fclose(file);
    $fclose(f_out);
end  
endmodule

This produces a very large string queue ‘arr’ that starts this way:
ffd8ffe000104a46494600010101012c012c0000ffe100d5457869660000
49492a000800000001000e010200b30000001a0000000000000031352046
656220313939363a2020416c6c616e20446f6e616c64206f6620536f7574
68204166726963612…

This queue is imported into the module in OP where I just want to read every character. I tried getc but it doesn’t work. I tried using arr[i] on RHS to assign it to a variable, that didn’t work either.