CollationKey.GetBound(Int32, Int32) Method

Definition

Produces a bound for the sort order of a given collation key and a strength level.

[Android.Runtime.Register("getBound", "(II)Landroid/icu/text/CollationKey;", "", ApiSince=24)]
public Android.Icu.Text.CollationKey? GetBound (int boundType, int noOfLevels);
[<Android.Runtime.Register("getBound", "(II)Landroid/icu/text/CollationKey;", "", ApiSince=24)>]
member this.GetBound : int * int -> Android.Icu.Text.CollationKey

Parameters

boundType
Int32

Mode of bound required. It can be BoundMode.LOWER, which produces a lower inclusive bound, BoundMode.UPPER, that produces upper bound that matches strings of the same length or BoundMode.UPPER_LONG that matches strings that have the same starting substring as the source string.

noOfLevels
Int32

Strength levels required in the resulting bound (for most uses, the recommended value is PRIMARY). This strength should be less than the maximum strength of this CollationKey. See users guide for explanation on the strength levels a collation key can have.

Returns

the result bounded CollationKey with a valid sort order but a null String representation.

Attributes

Remarks

Produces a bound for the sort order of a given collation key and a strength level. This API does not attempt to find a bound for the CollationKey String representation, hence null will be returned in its place.

Resulting bounds can be used to produce a range of strings that are between upper and lower bounds. For example, if bounds are produced for a sortkey of string "smith", strings between upper and lower bounds with primary strength would include "Smith", "SMITH", "sMiTh".

There are two upper bounds that can be produced. If BoundMode.UPPER is produced, strings matched would be as above. However, if a bound is produced using BoundMode.UPPER_LONG is used, the above example will also match "Smithsonian" and similar.

For more on usage, see example in test procedure src/com/ibm/icu/dev/test/collator/CollationAPITest/TestBounds.

Collation keys produced may be compared using the compare API.

Java documentation for android.icu.text.CollationKey.getBound(int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to