STD.Uni.LocaleFindAtStrength( source,target,instance,locale,strength )
source | A string containing the data to search. |
target | A string containing the substring to search for. |
instance | An integer specifying which occurrence of the target to find. |
locale | A null-terminated string containing the language and country code to use to determine correct sort order and other operations. |
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 | |
Return: | FindAtStrength returns an INTEGER value. |
The FindAtStrength function returns the beginning index position within the source string of the specified instance of the target string. If the target is not found or the specified instance is greater than the number of occurrences of the target in the source, StringFind returns zero (0).
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) search := seco + tert + base; STD.Uni.LocaleFindAtStrength(search, base, 1, 'fr', 1) = 1; // at strength 1, base matches seco (only secondary diffs) STD.Uni.LocaleFindAtStrength(search, base, 1, 'fr', 2) = 5; // at strength 2, base matches tert (only tertiary diffs) STD.Uni.LocaleFindAtStrength(search, base, 1, 'fr', 3) = 9; // at strength 3, base doesn't match either seco or tert STD.Uni.LocaleFindAtStrength(u'le caf\u00E9 vert', u'cafe', 1, 'fr', 2) = 4; // however, an accent on the source, STD.Uni.LocaleFindAtStrength(u'le caf\u00E9 vert', u'cafe', 1, 'fr', 3) = 4; // rather than on the pattern, STD.Uni.LocaleFindAtStrength(u'le caf\u00E9 vert', u'cafe', 1, 'fr', 4) = 4; // is ignored at strengths up to 4, STD.Uni.LocaleFindAtStrength(u'le caf\u00E9 vert', u'cafe', 1, 'fr', 5) = 0; // and only counts at strength 5