startTime = 34
endTime = 42
lineToPrint$ = "| 9:30 AM N-the lobby between 10:13 AM-N |"
timeString$
= MID$(lineToPrint$
, startTime
, endTime
)
IF LEN(checkForTime$) = 7 THEN
d1$ = Middle$(checkForTime$, 1, 1): digit1 = VAL(d1$)
colon$ = Middle$(checkForTime$, 2, 1)
From these two code snippets. it's obvious that Jaze has expectations that his code will read his mind. In the first, he wants MID$ to work with a (string, start point, end point) syntax In the second, he's expecting it to work with a (string, start point, number of characters) syntax.
You can't have it both ways!
MID$ itself works with the (string, start, number of bytes) syntax. MIDDLE$, which you wrote yourself, works with the (string, start point, end point) syntax. The two commands *AREN'T* interchangeable and you need to use the proper one to meet your expectations.
Since you posted code with using your custom MIDDLE$ sub, I'd imagine that the line in question should actually look like one of the two options below:
colon$ = Middle$(checkForTime$, 2, 2)
colon$ = Middle$(checkForTime$, 2, 3)
The proper one of those two variations will depend on exactly how you wrote your MIDDLE$ function. If it's start point, end point, then 2, 2 will be fine. If it's startpoint, endpoint - startpoint, then the 3,2 is probably what you need. Regardless, you can't start at position 2 and then try to get the proper information back from that point to position 1 as the end point. I doubt you wrote your code to read in reverse, so all you're going to get from 2, 1 with MIDDLE$ is a blank string "". (Even if you did write it to read in reverse, you'd just get a "1" and not the ":" as you're reading from the opposite direction...)
Syntax on our commands doesn't change. We can't expect it to conform to what we WANT it to be at our whimsey. Write it consistently and you won't have issues with it.