String comparison

Revision as of 06:25, 20 February 2021 by Drkameleon (talk | contribs)

Arturo

<lang rebol>loop [["YUP" "YUP"] ["YUP" "Yup"] ["bot" "bat"] ["aaa" "zz"]] 'x [

   print [x\0 "="  x\1 "=>" x\0 =  x\1]
   print [x\0 "=" x\1 "(case-insensitive) =>" (upper x\0) = upper x\1]
   print [x\0 "<>" x\1 "=>" x\0 <> x\1]
   print [x\0 ">"  x\1 "=>" x\0 >  x\1]
   print [x\0 ">=" x\1 "=>" x\0 >= x\1]
   print [x\0 "<"  x\1 "=>" x\0 <  x\1]
   print [x\0 "=<" x\1 "=>" x\0 =< x\1]
   print "----"

]</lang>

Output:
YUP = YUP => true 
YUP = YUP (case-insensitive) => true 
YUP <> YUP => false 
YUP > YUP => false 
YUP >= YUP => true 
YUP < YUP => false 
YUP =< YUP => true 
----
YUP = Yup => false 
YUP = Yup (case-insensitive) => true 
YUP <> Yup => true 
YUP > Yup => false 
YUP >= Yup => false 
YUP < Yup => true 
YUP =< Yup => true 
----
bot = bat => false 
bot = bat (case-insensitive) => false 
bot <> bat => true 
bot > bat => true 
bot >= bat => true 
bot < bat => false 
bot =< bat => false 
----
aaa = zz => false 
aaa = zz (case-insensitive) => false 
aaa <> zz => true 
aaa > zz => false 
aaa >= zz => false 
aaa < zz => true 
aaa =< zz => true 
----