techknight Well-Known Member Licensed User Longtime User Jan 27, 2021 #1 Now, I suppose I am getting more stupid as I age, but I must be missing the obvious. This works if its either one of the string matches, which is a desired operation: Code: Copy If VarD = "GqrNrmcZyTvqG67B" Or VarD = "E4YhdpBsQ88jWR6p" Then However, I am trying to do a return if VarD does not contain either one of those, like this: Code: Copy If VarD <> "GqrNrmcZyTvqG67B" Or VarD <> "E4YhdpBsQ88jWR6p" Then Return But, it doesnt work. it returns regardless if VarD has either one of the strings. I want it to work like this: If VarD doesn't contain either of those strings exactly as they are, then return. Thoughts? ?
Now, I suppose I am getting more stupid as I age, but I must be missing the obvious. This works if its either one of the string matches, which is a desired operation: Code: Copy If VarD = "GqrNrmcZyTvqG67B" Or VarD = "E4YhdpBsQ88jWR6p" Then However, I am trying to do a return if VarD does not contain either one of those, like this: Code: Copy If VarD <> "GqrNrmcZyTvqG67B" Or VarD <> "E4YhdpBsQ88jWR6p" Then Return But, it doesnt work. it returns regardless if VarD has either one of the strings. I want it to work like this: If VarD doesn't contain either of those strings exactly as they are, then return. Thoughts? ?
JordiCP Expert Licensed User Longtime User Jan 27, 2021 #2 Shouldn't it be AND instead of OR ? Upvote 0
techknight Well-Known Member Licensed User Longtime User Jan 27, 2021 #5 drgottjr said: @JordiCP - quina coindidència! Click to expand... ? Upvote 0
JordiCP Expert Licensed User Longtime User Jan 27, 2021 #6 drgottjr said: @JordiCP - quina coindidència! Click to expand... Glad to find you here again Upvote 0
techknight Well-Known Member Licensed User Longtime User Jan 27, 2021 #7 JordiCP said: Shouldn't it be AND instead of OR ? Click to expand... Told you I was getting more stupid as I age Upvote 0
JordiCP said: Shouldn't it be AND instead of OR ? Click to expand... Told you I was getting more stupid as I age
TILogistic Expert Licensed User Longtime User Jan 27, 2021 #8 ?? Use of Not B4X: Copy Dim VarD As String = "GqrNrmcZyTvqG67B" If Not(VarD = "GqrNrmcZyTvqG67B" Or VarD = "E4YhdpBsQ88jWR6p") Then Log(True) Else Log(False) End If Upvote 0
?? Use of Not B4X: Copy Dim VarD As String = "GqrNrmcZyTvqG67B" If Not(VarD = "GqrNrmcZyTvqG67B" Or VarD = "E4YhdpBsQ88jWR6p") Then Log(True) Else Log(False) End If
JordiCP Expert Licensed User Longtime User Jan 27, 2021 #9 techknight said: Told you I was getting more stupid as I age Click to expand... Time ago I had problems with such logic clauses and spent some neurons to remember NOT(a OR b) is equal to NOT(a) AND NOT(b) and similar ones... Upvote 0
techknight said: Told you I was getting more stupid as I age Click to expand... Time ago I had problems with such logic clauses and spent some neurons to remember NOT(a OR b) is equal to NOT(a) AND NOT(b) and similar ones...
techknight Well-Known Member Licensed User Longtime User Jan 27, 2021 #10 oparra said: ?? Use of Not B4X: Copy Dim VarD As String = "GqrNrmcZyTvqG67B" If Not(VarD = "GqrNrmcZyTvqG67B" Or VarD = "E4YhdpBsQ88jWR6p") Then Log(True) Else Log(False) End If Click to expand... Never even thought about that. Thanks Upvote 0
oparra said: ?? Use of Not B4X: Copy Dim VarD As String = "GqrNrmcZyTvqG67B" If Not(VarD = "GqrNrmcZyTvqG67B" Or VarD = "E4YhdpBsQ88jWR6p") Then Log(True) Else Log(False) End If Click to expand... Never even thought about that. Thanks
TILogistic Expert Licensed User Longtime User Jan 27, 2021 #11 ?? VarD.Contains("GqrNrmcZyTvqG67B") Or VarD.Contains("E4YhdpBsQ88jWR6p") Click to expand... Upvote 0
TILogistic Expert Licensed User Longtime User Jan 27, 2021 #12 JordiCP said: Time ago I had problems with such logic clauses and spent some neurons to remember NOT(a OR b) is equal to NOT(a) AND NOT(b) and similar ones... Click to expand... yes, sometimes we have a positive logic and never a negative. ????? Upvote 0
JordiCP said: Time ago I had problems with such logic clauses and spent some neurons to remember NOT(a OR b) is equal to NOT(a) AND NOT(b) and similar ones... Click to expand... yes, sometimes we have a positive logic and never a negative. ?????
techknight Well-Known Member Licensed User Longtime User Jan 27, 2021 #13 oparra said: ?? View attachment 107035 Click to expand... The problem with Contains, is I dont know if there were extra characters at the beginning or end, would it satisfy. the string needs to contain "exactly" that. nothing more or less or extra. Upvote 0
oparra said: ?? View attachment 107035 Click to expand... The problem with Contains, is I dont know if there were extra characters at the beginning or end, would it satisfy. the string needs to contain "exactly" that. nothing more or less or extra.
M Mahares Expert Licensed User Longtime User Jan 27, 2021 #14 oparra said: Use of Not Click to expand... Your code works great, but I wanted to be a little fancy like Erel would do sometimes: Code: Copy Log(oparra("GqrNrmcZyTvqG67B")) Code: Copy Sub oparra( Vard As String) As Boolean Return Not(Vard.Contains("GqrNrmcZyTvqG67B".trim) Or Vard.Contains("E4YhdpBsQ88jWR6p".trim)) End Sub or this: Code: Copy Sub oparra( Vard As String) As Boolean Return Not(Vard = "GqrNrmcZyTvqG67B" Or Vard = "E4YhdpBsQ88jWR6p") End Sub Upvote 0
oparra said: Use of Not Click to expand... Your code works great, but I wanted to be a little fancy like Erel would do sometimes: Code: Copy Log(oparra("GqrNrmcZyTvqG67B")) Code: Copy Sub oparra( Vard As String) As Boolean Return Not(Vard.Contains("GqrNrmcZyTvqG67B".trim) Or Vard.Contains("E4YhdpBsQ88jWR6p".trim)) End Sub or this: Code: Copy Sub oparra( Vard As String) As Boolean Return Not(Vard = "GqrNrmcZyTvqG67B" Or Vard = "E4YhdpBsQ88jWR6p") End Sub
TILogistic Expert Licensed User Longtime User Jan 27, 2021 #15 Mahares said: Your code works great, but I wanted to be a little fancy like Erel would do sometimes: Code: Copy Log(oparra("GqrNrmcZyTvqG67B")) Code: Copy Sub oparra( Vard As String) As Boolean Return Not(Vard.Contains("GqrNrmcZyTvqG67B".trim) Or Vard.Contains("E4YhdpBsQ88jWR6p".trim)) End Sub or this: Code: Copy Sub oparra( Vard As String) As Boolean Return Not(Vard = "GqrNrmcZyTvqG67B" Or Vard = "E4YhdpBsQ88jWR6p") End Sub Click to expand... I thought about it but was guided by the code of the post. an old saying: Although all roads lead to Rome. Upvote 0
Mahares said: Your code works great, but I wanted to be a little fancy like Erel would do sometimes: Code: Copy Log(oparra("GqrNrmcZyTvqG67B")) Code: Copy Sub oparra( Vard As String) As Boolean Return Not(Vard.Contains("GqrNrmcZyTvqG67B".trim) Or Vard.Contains("E4YhdpBsQ88jWR6p".trim)) End Sub or this: Code: Copy Sub oparra( Vard As String) As Boolean Return Not(Vard = "GqrNrmcZyTvqG67B" Or Vard = "E4YhdpBsQ88jWR6p") End Sub Click to expand... I thought about it but was guided by the code of the post. an old saying: Although all roads lead to Rome.