;Simulate list of filenames and exclude all "LOG" files.
Debug "Begin by excluding all files that contain 'LOG'"
For n = 1 To 30
x = Random(4294967295,1)
If Random(1,0)
If Random(1,0)
s$ = Hex(x) + ".PDF"
Else
s$ = Hex(x) + ".LOG"
EndIf
Else
If Random(1,0)
s$ = Hex(x) + ".PDF"
Else
s$ = Hex(x) + ".ARC"
EndIf
EndIf
;DO NOT list files that have "log" in name!!!
If FindString(check$,"log",#PB_String_NoCase) = 0
Debug s$
EndIf
Next n
Debug "Try again by checking last 3 characters"
For n = 1 To 30
x = Random(4294967295,1)
If Random(1,0)
If Random(1,0)
s$ = Hex(x) + ".PDF"
Else
s$ = Hex(x) + ".LOG"
EndIf
Else
If Random(1,0)
s$ = Hex(x) + ".PDF"
Else
s$ = Hex(x) + ".ARC"
EndIf
EndIf
;DO NOT list files that end with "log" in name!!!
If LCase(right(check$,3)) <> "log"
Debug s$
EndIf
Next n
Either way I get same inaccurate results. So . . . What am I doing wrong???
Last edited by Randy Walker on Tue Sep 24, 2024 10:01 pm, edited 1 time in total.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
1) In both examples, you're building a string called s$ - but testing a string called check$.
2) In the first section you're supplying the #PB_String_NoCase argument to the StartPosition parameter not the Mode parameter.
;Simulate list of filenames and exclude all "LOG" files.
Debug "Begin by excluding all files that contain 'LOG'"
For n = 1 To 30
x = Random(4294967295,1)
If Random(1,0)
If Random(1,0)
s$ = Hex(x) + ".PDF"
Else
s$ = Hex(x) + ".LOG"
EndIf
Else
If Random(1,0)
s$ = Hex(x) + ".PDF"
Else
s$ = Hex(x) + ".ARC"
EndIf
EndIf
;DO NOT list files that have "log" in name!!!
If FindString(s$,"log", 0, #PB_String_NoCase) = 0
Debug s$
EndIf
Next n
Debug "Try again by checking last 3 characters"
For n = 1 To 30
x = Random(4294967295,1)
If Random(1,0)
If Random(1,0)
s$ = Hex(x) + ".PDF"
Else
s$ = Hex(x) + ".LOG"
EndIf
Else
If Random(1,0)
s$ = Hex(x) + ".PDF"
Else
s$ = Hex(x) + ".ARC"
EndIf
EndIf
;DO NOT list files that end with "log" in name!!!
If LCase(Right(s$,3)) <> "log"
Debug s$
EndIf
Next n
Last edited by spikey on Tue Sep 24, 2024 9:53 pm, edited 1 time in total.
For n = 1 To 30
x = Random(4294967295,1)
If Random(1,0)
If Random(1,0)
s$ = Hex(x) + ".PDF"
Else
s$ = Hex(x) + ".LOG"
EndIf
Else
If Random(1,0)
s$ = Hex(x) + ".PDF"
Else
s$ = Hex(x) + ".ARC"
EndIf
EndIf
;List last 3 characters of ALL files.
Debug LCase(Right(check$,3))
;Show the whole filename.
Debug s$
Next n
Should NOT be seeing any blank lines in this listing.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
spikey wrote: Tue Sep 24, 2024 9:50 pm
1) In both examples, you're building a string called s$ - but testing a string called check$.
2) In the first section you're supplying the #PB_String_NoCase argument to the StartPosition parameter not the Mode parameter.
Hahaha, I'm such an idiot. Full of I/O errors. Thank you very much Spikey!!!
( I/O ) = "Idiot Operator"
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.