QB64 Phoenix Edition
Help with Select Case - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: Help with Select Case (/showthread.php?tid=159)



Help with Select Case - PhilOfPerth - 04-24-2022

Anyone help with a Select Case problem I have?
I want to select from text, using their ASCII codes, all the letters (A-Z and a-z) in two cases, and all other chars (spaces, punctuation etc.) in another case.
I've tried Case is >=65,<=90 (for the capitals) and Case is >=97, <=122 (for lower case) but it doesn't work - I think it sees all chars above and including A, then adds all letters below and including Z, so it grabs everything.
I think it needs an AND in there somewhere but I can't find a way.


RE: Help with Select Case - johnno56 - 04-24-2022

https://qb64sourcecode.com/ tutorial #5 covers "Conditions and Branching"... Hopefully that will help?


RE: Help with Select Case - SMcNeill - 04-24-2022

Code: (Select All)
Do
    k = _KeyHit
    If k > 0 Then
        Select Case k
            Case 65 To 90, 97 To 122
                Print "It's a letter!"
            Case Else
                Print "It's not a letter. :("
        End Select
    End If
    _Limit 30
Loop Until k = 27 'escape to quit

This little demo what you're looking for?


RE: Help with Select Case - PhilOfPerth - 04-24-2022

(04-24-2022, 06:33 AM)johnno56 Wrote: https://qb64sourcecode.com/ tutorial #5 covers "Conditions and Branching"... Hopefully that will help?

Thanks Johnno. I wasn't aware that that tut was there. Terry's on the ball!


RE: Help with Select Case - johnno56 - 04-24-2022

No probs. But I think Steve's example may be what you are needing... Wink


RE: Help with Select Case - PhilOfPerth - 04-24-2022

Yes!!!
I was missing the "to..." option.
If this keeps up I'll be out of Kindy before you know it!