10-12-2025, 12:58 PM
Intuitively you might think this would come back as "yes" answer:
a$ = "apples pears"
If Mid$(a$, 7) = " " Then
Print "yes"
Else
Print "no"
End If
Sorry it's a"no", but this is a "yes"
a$ = "apples pears"
If Asc(a$, 7) = 32 Then
Print "yes"
Else
Print "no"
End If
If it wasn't for the Wiki mentioning ASC is faster. I am have been stuck a bit longer. Reality is mid$ is used to move strings into or out of strings. Not for testing a value. Here is another tibit. Mother tongue QB45 says yes "mid$" is wrong usage, "asc" is the way. But "why is there always a but", maybe because everyone has one. QB45 only gets the first ASC character in the string. QB64pe allows a position of your choice for the asc value. For all my "QB" life I only used mid$ for substitute or pull character(s) in a string. Learn something new everyday. How much do you want to bet, I will forget this lesson.
/flame shield on
Ok come at me.
a$ = "apples pears"
If Mid$(a$, 7) = " " Then
Print "yes"
Else
Print "no"
End If
Sorry it's a"no", but this is a "yes"
a$ = "apples pears"
If Asc(a$, 7) = 32 Then
Print "yes"
Else
Print "no"
End If
If it wasn't for the Wiki mentioning ASC is faster. I am have been stuck a bit longer. Reality is mid$ is used to move strings into or out of strings. Not for testing a value. Here is another tibit. Mother tongue QB45 says yes "mid$" is wrong usage, "asc" is the way. But "why is there always a but", maybe because everyone has one. QB45 only gets the first ASC character in the string. QB64pe allows a position of your choice for the asc value. For all my "QB" life I only used mid$ for substitute or pull character(s) in a string. Learn something new everyday. How much do you want to bet, I will forget this lesson.
/flame shield on
Ok come at me.


