Skip to content

Most visited

Recently visited

navigation
Added in API level 1

FieldPosition

public class FieldPosition
extends Object

java.lang.Object
   ↳ java.text.FieldPosition


Identifies fields in formatted strings. If a FieldPosition is passed to the format method with such a parameter, then the indices will be set to the start and end indices of the field in the formatted string.

A FieldPosition can be created by using the integer constants in the various format classes (for example NumberFormat.INTEGER_FIELD) or one of the fields of type Format.Field.

If more than one field position is needed, the method formatToCharacterIterator(Object) should be used.

Summary

Public constructors

FieldPosition(int field)

Constructs a new FieldPosition for the given field id.

FieldPosition(Format.Field attribute)

Constructs a new FieldPosition for the given Field attribute.

FieldPosition(Format.Field attribute, int field)

Constructs a new FieldPosition for the given Field attribute and field id.

Public methods

boolean equals(Object object)

Compares the given object to this field position and indicates if they are equal.

int getBeginIndex()

Returns the index of the beginning of the field.

int getEndIndex()

Returns the index one past the end of the field.

int getField()

Returns the field which is being identified.

Format.Field getFieldAttribute()

Returns the attribute which is being identified.

int hashCode()

Returns an integer hash code for this object.

void setBeginIndex(int index)

Sets the index of the beginning of the field.

void setEndIndex(int index)

Sets the index of the end of the field.

String toString()

Returns the string representation of this field position.

Inherited methods

From class java.lang.Object

Public constructors

FieldPosition

Added in API level 1
FieldPosition (int field)

Constructs a new FieldPosition for the given field id.

Parameters
field int

FieldPosition

Added in API level 1
FieldPosition (Format.Field attribute)

Constructs a new FieldPosition for the given Field attribute.

Parameters
attribute Format.Field

FieldPosition

Added in API level 1
FieldPosition (Format.Field attribute, 
                int field)

Constructs a new FieldPosition for the given Field attribute and field id.

Parameters
attribute Format.Field
field int

Public methods

equals

Added in API level 1
boolean equals (Object object)

Compares the given object to this field position and indicates if they are equal. In order to be equal, object must be an instance of FieldPosition with the same field, begin index and end index.

Parameters
object Object: the object to compare this instance with.
Returns
boolean true if the specified object is equal to this Object; false otherwise.

getBeginIndex

Added in API level 1
int getBeginIndex ()

Returns the index of the beginning of the field.

Returns
int

getEndIndex

Added in API level 1
int getEndIndex ()

Returns the index one past the end of the field.

Returns
int

getField

Added in API level 1
int getField ()

Returns the field which is being identified.

Returns
int

getFieldAttribute

Added in API level 1
Format.Field getFieldAttribute ()

Returns the attribute which is being identified.

Returns
Format.Field

hashCode

Added in API level 1
int hashCode ()

Returns an integer hash code for this object. By contract, any two objects for which equals(Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

Note that hash values must not change over time unless information used in equals comparisons also changes.

See Writing a correct hashCode method if you intend implementing your own hashCode method.

Returns
int this object's hash code.

setBeginIndex

Added in API level 1
void setBeginIndex (int index)

Sets the index of the beginning of the field.

Parameters
index int

setEndIndex

Added in API level 1
void setEndIndex (int index)

Sets the index of the end of the field.

Parameters
index int

toString

Added in API level 1
String toString ()

Returns the string representation of this field position.

Returns
String a printable representation of this object.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.