The loop case tooks times for onlmy 12,000 characters to check (first in a select case, then in an If block).
For some reason (forgotten), in another project, I used (I do not remember, but it returned 1 or > 1) instead of InStr and does not understand why the program does not always do what I wanted. It tooks me some minutes (and a coffee) to understand my mistake. It was a case of “automatic write” (I wrote that word because I wrote it ! Never knew why; probably a mistake / I took one word instead of another, just like a mother can use one of its childs name to call another 'till she realize her error ;- This happened to Mother, sometimes).
When you want to count strings in huge strings (e.g. file content) you should use Memoryblocks instead of countFiledsB. Couple of Month ago there was a topic here in forum but I missed to bookmark it.
First off, start with a question… not a generic plea for help
Second, show us what you have tried to do already… the purpose of this forum is to help you use XOJO to solve problems, but you have to be willing to try and figure things out for yourself as well
dim count as integer=0
dim i as integer
for i=0 to 10000
if instr(str(i),"7")>0 then count=count+1
next i
msgbox str(count)