Skip to content

Most visited

Recently visited

navigation
Added in API level 1

ParsePosition

public class ParsePosition
extends Object

java.lang.Object
   ↳ java.text.ParsePosition


Tracks the current position in a parsed string. In case of an error the error index can be set to the position where the error occurred without having to change the parse position.

Summary

Public constructors

ParsePosition(int index)

Constructs a new ParsePosition with the specified index.

Public methods

boolean equals(Object object)

Compares the specified object to this ParsePosition and indicates if they are equal.

int getErrorIndex()

Returns the index at which the parse could not continue.

int getIndex()

Returns the current parse position.

int hashCode()

Returns an integer hash code for this object.

void setErrorIndex(int index)

Sets the index at which the parse could not continue.

void setIndex(int index)

Sets the current parse position.

String toString()

Returns the string representation of this parse position.

Inherited methods

From class java.lang.Object

Public constructors

ParsePosition

Added in API level 1
ParsePosition (int index)

Constructs a new ParsePosition with the specified index.

Parameters
index int: the index to begin parsing.

Public methods

equals

Added in API level 1
boolean equals (Object object)

Compares the specified object to this ParsePosition and indicates if they are equal. In order to be equal, object must be an instance of ParsePosition and it must have the same index and error index.

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

See also:

getErrorIndex

Added in API level 1
int getErrorIndex ()

Returns the index at which the parse could not continue.

Returns
int the index of the parse error or -1 if there is no error.

getIndex

Added in API level 1
int getIndex ()

Returns the current parse position.

Returns
int the current position.

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.

setErrorIndex

Added in API level 1
void setErrorIndex (int index)

Sets the index at which the parse could not continue.

Parameters
index int: the index of the parse error.

setIndex

Added in API level 1
void setIndex (int index)

Sets the current parse position.

Parameters
index int: the current parse position.

toString

Added in API level 1
String toString ()

Returns the string representation of this parse position.

Returns
String the string representation of this parse position.
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.