ParsePosition getIndex Example

ParsePosition class getIndex example. This example shows you how to use getIndex method.


ParsePosition class getIndex example. 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.

Here is the code
/*
 * @ # GetIndex.java
 * A class repersenting use to getIndex method of
 * ParsePosition class in java.text package
 * version 13 June 2008
 * author Rose India 
 */

import java.text.*;

public class GetIndex {

    public static void main(String args[]) {
        // create instance of parse position 
        ParsePosition p = new ParsePosition(10);

        // Retrieve the current parse position.
        System.out.println("Current parse position. " + p.getIndex());
    }
}

Output
Current parse position. 10

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US