Hello all!
I would like some clarity on how Xojo handles Select Case statements when the expression is a text character such as:
Select Case Cmd
Case "b"
......
Is this handled the same as
If Cmd = "b" Then
wherein Case Insensitivity is used?
With the changes to the framework, what is the best way to create new code? I’d hate to redo all of the code already written, but probably better to do so now, before a product release…
BTW, these test are used to create command strings which will be sent through the serial port.
Thanks in advance all!
Tim
There is no change in the new framework with Select case. And AFAIK indeed “a” is not case sensitive. Like all Xojo default string compare.
It is easy to test, though:
[code]Dim test as string = “A”
Select case test
case “a”
msgbox “Not case sensitive”
case “A”
msgbox “Case sensitive”
end select[/code]
http://documentation.xojo.com/index.php/Select_Case
If you needed it to be case sensitive, you could do something like this:
select case 0
Case StrComp(test,"A",0)
// uppercase A
Case StrComp(test,"a",0)
// lowercase a
End Select
Edit: Kem’s way is cleaner
In the new framework, use
select case 0
case cmd.Compare( "a", Text.CompareCaseSensitive )