Code example for ParsePosition

Methods: getIndex

0
 
 
    public static void main(String[] av) throws ParseException {
 
        String input = "11 ss";
        ParsePosition pp = new ParsePosition(0);
        NumberFormat.getInstance().parse(input, pp);
         
        if(pp.getIndex() != (input.length() - 1))
            throw new RuntimeException("failed to parse");
 
    } 
 
}