ConstrainedFieldPosition.ConstrainField(_Format+Field) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets a constraint on the field.
[Android.Runtime.Register("constrainField", "(Ljava/text/Format$Field;)V", "GetConstrainField_Ljava_text_Format_Field_Handler", ApiSince=31)]
public virtual void ConstrainField(Java.Text._Format.Field? field);
[<Android.Runtime.Register("constrainField", "(Ljava/text/Format$Field;)V", "GetConstrainField_Ljava_text_Format_Field_Handler", ApiSince=31)>]
abstract member ConstrainField : Java.Text._Format.Field -> unit
override this.ConstrainField : Java.Text._Format.Field -> unit
Parameters
- field
- _Format.Field
The field to fix when iterating.
- Attributes
Remarks
Sets a constraint on the field. When this instance of ConstrainedFieldPosition is passed to FormattedValue.nextPosition, positions are skipped unless they have the given field. Any previously set constraints are cleared. For example, to loop over all grouping separators:
ConstrainedFieldPosition cfpos;
cfpos.constrainField(NumberFormat.Field.GROUPING_SEPARATOR);
while (fmtval.nextPosition(cfpos)) {
// handle the grouping separator position
}
Changing the constraint while in the middle of iterating over a FormattedValue does not generally have well-defined behavior.
Android reference for android.icu.text.ConstrainedFieldPosition.constrainField.
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.