Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with Select Case
#1
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.
Reply
#2
https://qb64sourcecode.com/ tutorial #5 covers "Conditions and Branching"... Hopefully that will help?
May your journey be free of incident. Live long and prosper.
Reply
#3
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?
Reply
#4
(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!
Reply
#5
No probs. But I think Steve's example may be what you are needing... Wink
May your journey be free of incident. Live long and prosper.
Reply
#6
Yes!!!
I was missing the "to..." option.
If this keeps up I'll be out of Kindy before you know it!
Reply




Users browsing this thread: 1 Guest(s)