String comparison: Difference between revisions

m
m (→‎{{header|Fortran}}: Why I dislike this usage.)
Line 927:
Exact matching is problematic, because trailing spaces are disregarded so that <code>"blah" .EQ. "blah "</code> yields ''true''. Thus, the quality of equality is strained. To test for "exact" equality the lengths would have to be compared also, as in <code>TEXT1.EQ.TEXT2 .AND. LEN(TEXT1).EQ.LEN(TEXT2)</code>
 
All character comparisons are literal: case counts. There is no facility for case insensitive comparison (though in principle a compiler could inoffer principleto supportdo so via non-standard mnemonics) and there often are no library routines for case conversion. The usual procedure is to copy both items to scratch variables (with all the annoyance of "how big?), convert both to upper case (or both to lower case) and then compare. Or, rather than copying the strings, one might code for a character-by-character comparison and handling case differences one character at a time.
 
=={{header|F_Sharp|F#}}==
1,220

edits