JCL Help:StrCompare@AnsiString@AnsiString@Boolean

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Compares two strings.


Pascal

 function StrCompare(const S1: string; const S2: string; CaseSensitive: Boolean = False): SizeInt;
function StrCompare(const S1: AnsiString; const S2: AnsiString; CaseSensitive: Boolean = False): SizeInt;


Parameters

Parameters Description
const S1: string First string to compare.
const S2: string Second string to compare.


Return Value

StrCompare returns 0 if the two strings match or the number of different characters in case of a mismatch.


Description

StrCompare implements a case-insensitive comparison between the two supplied strings. If the two strings match the function returns 0 otherwise it returns the number of different characters. If the supplied strings are of equal length but are not identical the function returns the difference of the first mismatched character. The table below demonstrates this:

S1 S2 Result
jedi jedi 0
jedi je 2
di jedi -2
project jedi jedi 8
jedi project jedi -8
jedi judi Ord('e') - Ord('u')
JEDI Judi Ord(LowerCase('E')) - Ord('u')


About

Unit

JclAnsiStrings


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