Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
33
Task/String-comparison/QB64/string-comparison.qb64
Normal file
33
Task/String-comparison/QB64/string-comparison.qb64
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
Dim As String String1, String2
|
||||
|
||||
' direct string comparison using case sensitive
|
||||
String1 = "GWbasic"
|
||||
String2 = "QuickBasic"
|
||||
If String1 = String2 Then Print String1; " is equal to "; String2 Else Print String1; " is NOT egual to "; String2
|
||||
String1 = "gWbasic"
|
||||
String2 = "GWBasic"
|
||||
If String1 = String2 Then Print String1; " is equal to "; String2 Else Print String1; " is NOT egual to "; String2
|
||||
|
||||
' direct string comparison using case insensitive
|
||||
If UCase$(String1) = UCase$(String2) Then Print String1; " is equal to "; String2; Else Print String1; " is NOT egual to "; String2;
|
||||
Print " case insensitive"
|
||||
String1 = "GwBasiC"
|
||||
String2 = "GWBasic"
|
||||
If LCase$(String1) = LCase$(String2) Then Print String1; " is equal to "; String2; Else Print String1; " is NOT egual to "; String2;
|
||||
Print " case insensitive"
|
||||
|
||||
' lexical order
|
||||
String1 = "AAAbbb"
|
||||
String2 = "AaAbbb"
|
||||
If String1 > String2 Then Print String1; " is after "; String2 Else Print String1; " is before "; String2
|
||||
|
||||
' number in string format comparison
|
||||
String1 = "0123"
|
||||
String2 = "5"
|
||||
' lexical order
|
||||
If String1 > String2 Then Print String1; " is after "; String2 Else Print String1; " is before "; String2
|
||||
' value order
|
||||
If Val(String1) > Val(String2) Then Print String1; " is bigger than "; String2 Else Print String1; " is lower "; String2
|
||||
|
||||
Print "QB64, like QBasic, has native coercive/allomorphic operators for string type variable"
|
||||
End
|
||||
Loading…
Add table
Add a link
Reference in a new issue