- Introduction
- License
- History
- Compilation & Hosting
- Configuration File
- Modules:
- FAQ
- Links
- Credits
|
Declaration:
-
function str_incomp(const str1, str2: string): shortint;
Arguments:
-
str1 |
First string |
str2 |
Second string |
Description:
-
This function compares 2 strings using natural comparison algorithm. It means that it compares strings as we do: literal part in alphabetical order, numeric part by value. So, in difference from str_incomp it will tell that 'foo2' < 'foo120'. Comparison is case insensitive.
Returns:
-
-1 if str1 < str2, 0 if str1 = str2 and 1 if str1 > str2.
Usage:
-
readln(s1);
readln(s2);
if str_incomp(s1, s2) < 0 then writeln('S1 is less than S2')
else if str_incomp(s1, s2) = 0 then writeln('S1 equals S2')
else writeln('S1 is greater than S2');
See also:
-
str_ncomp, str_comp.
|