Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 675
نمايش فراداده

ParsePositionjava.text

Java 1.1

ParsePosition objects are passed to the parse( ) and parseObject( ) methods of Format and its subclasses. The ParsePosition class represents the position in a string at which parsing should begin or at which parsing stopped. Before calling a parse( ) method, you can specify the starting position of parsing by passing the desired index to the ParsePosition( ) constructor or by calling the setIndex( ) of an existing ParsePosition object. When parse( ) returns, you can determine where parsing ended by calling getIndex( ). When parsing multiple objects or values from a string, a single ParsePosition object can be used sequentially.

public class

ParsePosition { // Public Constructors public

ParsePosition (int

index ); // Public Instance Methods

1.2 public int

getErrorIndex ( ); public int

getIndex ( );

1.2 public void

setErrorIndex (int

ei ); public void

setIndex (int

index ); // Public Methods Overriding Object

1.2 public boolean

equals (Object

obj );

1.2 public int

hashCode ( );

1.2 public String

toString ( ); }

Passed To

ChoiceFormat.parse( ), DateFormat.{parse( ), parseObject( )}, DecimalFormat.parse( ), Format.parseObject( ), MessageFormat.{parse( ), parseObject( )}, NumberFormat.{parse( ), parseObject( )}, SimpleDateFormat.parse( )