String comparison: Difference between revisions

Added 11l
(Undo revision 324768 by Drkameleon (talk))
(Added 11l)
Line 28:
{{Template:Strings}}
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
Note: 11l does not have case-insensitive string comparison operators, instead use <code>name.upper()</code> or <code>name.lower()</code> to coerce strings to the same case and compare the results.
 
<lang 11l>F compare(a, b)
I a < b {print(‘'#.' is strictly less than '#.'’.format(a, b))}
I a <= b {print(‘'#.' is less than or equal to '#.'’.format(a, b))}
I a > b {print(‘'#.' is strictly greater than '#.'’.format(a, b))}
I a >= b {print(‘'#.' is greater than or equal to '#.'’.format(a, b))}
I a == b {print(‘'#.' is equal to '#.'’.format(a, b))}
I a != b {print(‘'#.' is not equal to '#.'’.format(a, b))}
 
compare(‘YUP’, ‘YUP’)
compare(‘BALL’, ‘BELL’)
compare(‘24’, ‘123’)</lang>
 
{{out}}
<pre>
'YUP' is less than or equal to 'YUP'
'YUP' is greater than or equal to 'YUP'
'YUP' is equal to 'YUP'
'BALL' is strictly less than 'BELL'
'BALL' is less than or equal to 'BELL'
'BALL' is not equal to 'BELL'
'24' is strictly greater than '123'
'24' is greater than or equal to '123'
'24' is not equal to '123'
</pre>
 
=={{header|AArch64 Assembly}}==
Line 213 ⟶ 243:
.include "../includeARM64.inc"
</lang>
 
=={{header|Ada}}==
Ada uses the usual comparison operators ("=" for equality, "/=" for not being equal, etc.) for strings. One uses the same comparison operators to compare variables of other types (integers, floating point numbers, etc.).
1,481

edits