From Clomosy Docs

No edit summary
No edit summary
 
Line 48: Line 48:
<h2> See Also </h2>
<h2> See Also </h2>
* [[System_Library#String_Functions | String Functions]]
* [[System_Library#String_Functions | String Functions]]
{{#seo:|title=AnsiCompareStr Using in Clomosy - Clomosy Docs}}
{{#seo:|description=AnsiCompareStr compares two strings with case sensitivity based on the current locale, returning a value to indicate their relative order.}}
{{#seo:|description=AnsiCompareStr compares two strings with case sensitivity based on the current locale, returning a value to indicate their relative order.}}

Latest revision as of 14:05, 24 December 2024

Compares strings based on the current locale with case sensitivity.

AnsiCompareStr compares S1 to S2, with case sensitivity. The comparison operation is controlled by the current locale. The return value is one of the following.

The comparison is not affected by length - it is carried out on a letter by letter basis. But a longer string is greater than a shorter, otherwise matching string.
The comparison is case sensitive.

Example

 var
   initialValue,secondValue : String;
   resultValue :Integer;
 
 {
 
   initialValue = 'Clomosy';
   secondValue  = 'Clomosy';
   
   resultValue = AnsiCompareStr(initialValue, secondValue);
   
   if (resultValue < 0) ShowMessage(initialValue+' < '+secondValue);
   if (resultValue == 0) ShowMessage(initialValue+' = '+secondValue);
   if (resultValue > 0) ShowMessage(initialValue+' > '+secondValue);
 
 }

Output:

See Also