Java™ Platform
Standard Ed. 8
compact1, compact2, compact3
java.text
Class ParsePosition
-
-
Constructor Summary
Constructors
| Constructor |
Description |
ParsePosition(int index) |
Create a new ParsePosition with the given initial index.
|
-
Method Summary
All Methods Instance Methods Concrete Methods
| Modifier and Type |
Method |
Description |
boolean |
equals(Object obj) |
Overrides equals
|
int |
getErrorIndex() |
Retrieve the index at which an error occurred, or -1 if the
error index has not been set.
|
int |
getIndex() |
Retrieve the current parse position.
|
int |
hashCode() |
Returns a hash code for this ParsePosition.
|
void |
setErrorIndex(int ei) |
Set the index at which a parse error occurred.
|
void |
setIndex(int index) |
Set the current parse position.
|
String |
toString() |
Return a string representation of this ParsePosition.
|
-
-
Method Detail
-
getIndex
public int getIndex()
Retrieve the current parse position. On input to a parse method, this
is the index of the character at which parsing will begin; on output, it
is the index of the character following the last character parsed.
- Returns:
- the current parse position
-
setErrorIndex
public void setErrorIndex(int ei)
Set the index at which a parse error occurred. Formatters
should set this before returning an error code from their
parseObject method. The default value is -1 if this is not set.
- Parameters:
ei - the index at which an error occurred
- Since:
- 1.2
-
getErrorIndex
public int getErrorIndex()
Retrieve the index at which an error occurred, or -1 if the
error index has not been set.
- Returns:
- the index at which an error occurred
- Since:
- 1.2
Java™ Platform
Standard Ed. 8
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.