PA_CompareStrings

4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next

version 2003


PA_CompareStrings (text1; text1Length; text2; text2Length; diacritic) char

ParameterTypeDescription
text1char *The text to compare to text2
text1LengthlongNumber of chars in text1
text2char *The text to be compared with text1
text2LengthlongNumber of chars in text2
diacriticchar1 = Use diacritic compare
Function resultcharResult of the comparison (0, 1 or 2)

Description

The routine PA_CompareStrings compares 2 texts and returns 0 if they are equals, 1 if text 1 is greater than text2, and 2 if text1 is less than text2.

Pass in text1 a pointer to the text to be compared to text2, and its length in text1length.

Pass in text2 a pointer to the text to be compared at text1, and its length in text2length.

Pass 0 (no diacritical comparison) or 1 (diacritical comparison) in diacritical.

A diacritical comparison means that the comparison is case sensitive.

Depending on default settings or on previous calls to PA_UseMacCharacters or PA_UseANSICharacters, text1 and text2 may use Macintosh or ANSI characters.

Example

Some comparisons.

   PA_CompareStrings( "ABC", 3, "abc", 3, 0 ) returns 0 in non diacritical mode (strings are equals)
   PA_CompareStrings( "ABC", 3, "abc", 3, 1 ) returns 2 in diacritical mode  (ABC is before abc)
   PA_CompareStrings( "bbb", 3, "aaa", 3, 0 ) returns 1 (bbb is after aaa in alphabetical order)   
   PA_CompareStrings( "aaa", 3, "bbb", 3, 0 ) returns 2 (aaa is before bbb in alphabetical order)

See Also

PA_ConvertStrings.

Error Handling

Use PA_GetLastError to see if an error occurred


4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next