String comparison: Difference between revisions

Content added Content deleted
m (promoted to task)
(Add Racket entry)
Line 260: Line 260:
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|Racket}}==

<lang racket>
#lang racket

;; Comparing two strings for exact equality
(string=? "foo" "foo")

;; Comparing two strings for inequality
(not (string=? "foo" "bar"))

;; Comparing two strings to see if one is lexically ordered before than the other
(string<? "abc" "def")

;; Comparing two strings to see if one is lexically ordered after than the other
(string>? "def" "abc")

;; How to achieve both case sensitive comparisons and case insensitive comparisons within the language
(string-ci=? "foo" "FOO")
</lang>


=={{header|REXX}}==
=={{header|REXX}}==