JCL Help:StrCompareRange@AnsiString@AnsiString@SizeInt@SizeInt@Boolean
JCL Help: StrCompareRange Function
Search in JCL Help
Search in all projects
Summary
Compares two (sub) strings.
Pascal
function StrCompareRange(const S1: string; const S2: string; Index: SizeInt; Count: SizeInt; CaseSensitive: Boolean = True): SizeInt;
function StrCompareRange(const S1: AnsiString; const S2: AnsiString; Index: SizeInt; Count: SizeInt; CaseSensitive: Boolean = True): SizeInt;
Parameters
Parameters | Description |
const S1: string | First string to compare. |
const S2: string | Second string to compare. |
Index: SizeInt | Starting index of sub-string in S1 to. |
Count: SizeInt | Number of characters of the sub-string in S1 to compare to S2. |
Return Value
StrCompareRange returns 0 if the two strings match or the number of different characters in case of a mismatch.
Description
StrCompareRange compares, case-sensitive, a sub-string from the first supplied string with the second string. If the two strings are identical the function returns 0 otherwise it returns an indication of difference between the two strings, The result is equal to the result returned by StrCompare. This function is particularly useful to avoid code such as: "if Copy(S, 1, 4) = 'JEDI' then ..." which is quite inefficient. This code would be rewritten to: "if StrCompareRange(S1, 'JEDI', 1, 4) = 0 then ...".
See Also
About
Unit
Donator
Azret Botash
Contribute to this help topic
This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page