- Introduction
- License
- History
- Compilation & Hosting
- Configuration File
- Modules:
- FAQ
- Links
- Credits
|
Declaration:
-
function str_icomp(const str1, str2: string): shortint;
Arguments:
-
str1 |
First string |
str2 |
Second string |
Description:
-
This function compares 2 strings using classical comparison method by ASCII value. It compares ASCII value of each character and takes strings length in account also. With this method 'foo' > 'bar', 'FOO' = 'foo', 'foobar' > 'foob' but 'foo2' > 'foo120' as only ASCII values are compared. In difference from str_comp this function is case insensitive.
Returns:
-
-1 if str1 < str2, 0 if str1 = str2 and 1 if str1 > str2.
Usage:
-
readln(s1);
readln(s2);
if str_icomp(s1, s2) < 0 then writeln('S1 is less than S2')
else if str_icomp(s1, s2) = 0 then writeln('S1 equals S2')
else writeln('S1 is greater than S2');
See also:
-
str_comp, str_ncomp.
|