Compare a list of strings: Difference between revisions
Content added Content deleted
(→{{header|Java}}: fix equals check) |
(→{{header|Ring}}: remove off-topic code that compares single strings, not lists of strings) |
||
Line 2,548: | Line 2,548: | ||
return 1 /*indicate strings have true comparison*/</lang> |
return 1 /*indicate strings have true comparison*/</lang> |
||
{{out|output|text= is identical to the above REXX version.}} <br><br> |
{{out|output|text= is identical to the above REXX version.}} <br><br> |
||
=={{header|Ring}}== |
|||
<lang ring> |
|||
cString1 = "hello" |
|||
cString2 = "hello" |
|||
compare(cString1,cString2) |
|||
cString1 = "abc" |
|||
cString2 = "bcd" |
|||
compare(cString1,cString2) |
|||
cString1 = "bcd" |
|||
cString2 = "abc" |
|||
compare(cString1,cString2) |
|||
func compare aString, bString |
|||
n = strcmp(aString,bString) |
|||
if n = 0 see aString + " = " + bString + nl |
|||
but n < 0 see aString + " < " + bString + nl |
|||
but n > 0 see aString + " > " + bString + nl ok |
|||
</lang> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |