Skip to Content
Java in a Nutshell, 5th Edition
book

Java in a Nutshell, 5th Edition

by David Flanagan
March 2005
Intermediate to advanced
1254 pages
104h 21m
English
O'Reilly Media, Inc.
Content preview from Java in a Nutshell, 5th Edition

Name

ParsePosition

Synopsis

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( )

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java in a Nutshell, 8th Edition

Java in a Nutshell, 8th Edition

Benjamin J. Evans, Jason Clark, David Flanagan
Java in a Nutshell, 7th Edition

Java in a Nutshell, 7th Edition

Benjamin J. Evans, David Flanagan
Learning Java, 5th Edition

Learning Java, 5th Edition

Marc Loy, Patrick Niemeyer, Daniel Leuck
Learning Java, 4th Edition

Learning Java, 4th Edition

Patrick Niemeyer, Daniel Leuck

Publisher Resources

ISBN: 0596007736Supplemental ContentErrata Page