Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using And with two InStr calls
#1
Anybody know how to make this work?  Maybe a 'Not InStr Xor InStr'?   My problem is InStr doesn't return true or false, but the position of the substring inside the string.  Maybe I need to rethink the whole structure.  I want to be able to default to -sh (run CreateSheet) if no option is given.

Code: (Select All)

If InStr(LCase$(opt$), "-sh") And InStr(LCase$(opt$), "-st") Then
    Print "-sh -st"
    CreateSheet sheet&, f_names$(), n_count&, bpp&
    CreateStrip strip&, f_names$(), n_count&, bpp&
ElseIf InStr(LCase$(opt$), "-st") Then
    Print "-st"
    CreateStrip strip&, f_names$(), n_count&, bpp&
Else
    CreateSheet sheet&, f_names$(), n_count&, bpp&
End If
Reply
#2
Try add > 0
 if instr.... > 0 and instr... > 0 then...


Reply
#3
_AndAlso for logic decisions and not binary comparisons.

If instr... _AndAlso instr.... then
Reply
#4
Thank you both.  I knew the answer was probably simple.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Instr to count occurrences PhilOfPerth 5 927 04-29-2025, 11:17 PM
Last Post: TempodiBasic
  A Question on Calls to Subroutines Dimster 10 2,128 11-26-2023, 03:25 PM
Last Post: Dimster
  Reverse INSTR ? TerryRitchie 4 941 05-01-2023, 09:00 PM
Last Post: TerryRitchie
  INSTR bug? GTC 3 974 02-27-2023, 03:09 PM
Last Post: GTC

Forum Jump:


Users browsing this thread: 1 Guest(s)