STD.Uni.CompareAtStrength( source1, source2, strength )
STD.Uni.LocaleCompareAtStrength( source1,source2,locale,strength )
| source1 | A string containing the data to compare. |
| source2 | A string containing the data to compare. |
| strength | An integer value indicating how to compare. Valid values are: |
| 1 ignores accents and case, differentiating only between letters. | |
| 2 ignores case but differentiates between accents. | |
| 3 differentiates between accents and case but ignores e.g. differences between Hiragana and Katakana | |
| 4 differentiates between accents and case and e.g. Hiragana/Katakana, but ignores e.g. Hebrew cantellation marks | |
| 5 differentiates between all strings whose canonically decomposed forms (NFD--Normalization Form D) are non-identical | |
| locale | A null-terminated string containing the language and country code to use to determine correct sort order and other operations. |
| Return: | CompareAtStrength returns an INTEGER value. |
The CompareAtStrength functions return zero (0) if the source1 and source2 strings contain the same data, ignoring any differences in the case of the letters. These functions return negative one (-1) if source1 < source2 or positive one (1) if source1 > source2.
Example:
base := u'caf\u00E9'; // U+00E9 is lowercase e with acute
prim := u'coffee shop'; // 1st difference, different letters
seco := u'cafe'; // 2nd difference, accents (no acute)
tert := u'Caf\u00C9'; // 3rd, caps (U+00C9 is u/c E + acute)
A := STD.Uni.CompareAtStrength(base, prim, 1) != 0;
// base and prim differ at all strengths
A := STD.Uni.CompareAtStrength(base, seco, 1) = 0;
// base and seco same at strength 1 (differ only at strength 2)
A := STD.Uni.CompareAtStrength(base, tert, 1) = 0;
// base and tert same at strength 1 (differ only at strength 3)
A := STD.Uni.CompareAtStrength(base, seco, 2) != 0;
// base and seco differ at strength 2
A := STD.Uni.CompareAtStrength(base, tert, 2) = 0;
// base and tert same at strength 2 (differ only at strength 3)
A := STD.Uni.CompareAtStrength(base, seco, 3) != 0;
// base and seco differ at strength 2
A := STD.Uni.CompareAtStrength(base, tert, 3) != 0;
// base and tert differ at strength 3