String comparison: Difference between revisions

Content added Content deleted
(Added solution for Action!)
(Added Quackery.)
Line 2,976: Line 2,976:
5.0 is equal to 5
5.0 is equal to 5
5.0 has negated object identity with 5</pre>
5.0 has negated object identity with 5</pre>

=={{header|Quackery}}==

As a dialogue in the Quackery shell.

<pre>/O> ( compare two strings for equality )
... $ "abc" $ "xyz" =
... echo ( 0 = true, 1 = false )
...
0
Stack empty.

/O> ( compare two strings for inequality )
... $ "abc" $ "xyz" !=
... echo ( 0 = true, 1 = false )
...
1
Stack empty.

//O> ( compare two strings to see if one is lexically ordered before the other )
... $ "abc" $ "xyz" $<
... echo ( 0 = true, 1 = false )
...
1
Stack empty.

/O> ( compare two strings to see if one is lexically ordered after the other )
... $ "abc" $ "xyz" swap $>
... echo ( 0 = true, 1 = false )
...
1
Stack empty.

/O> ( for case insensitive, convert both strings to the same case )
... [ $ "" swap witheach [ upper join ] ] is upper$ ( $ --> $ )
... $ "AbC" upper$ $ "aBc" upper$ =
... echo ( 0 = true, 1 = false )
...
1
Stack empty.

/O> ( Numeric strings are not treated differently to other strings. )
... ( Lexical ordering uses QACSFOT rather than ASCII/Unicode ordering. )
( )
... ( "Quackery Arbitrary Character Sequence For Ordered Text" )
... ( 0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrS )
... ( sTtUuVvWwXxYyZz()[]{}<>~=+-*/^\|_.,:;?!'"`%@&#$ )
...

Stack empty.</pre>


=={{header|R}}==
=={{header|R}}==