Code example for ParsePosition

Methods: getErrorIndexgetIndex

     * @see #format 
     * @stable ICU 2.0 
    //Bug 4375399 [Richard/GCL] 
    public Number parse(String text) throws ParseException {
        ParsePosition parsePosition = new ParsePosition(0);
        Number result = parse(text, parsePosition);
        if (parsePosition.getIndex() == 0) {
            throw new ParseException("Unparseable number: \"" + text + '"',
        return result;
     * Parses text from the given string as a CurrencyAmount.  Unlike 
     * the parse() method, this method will attempt to parse a generic 
     * currency name, searching for a match of this object's locale's 
     * currency display names, or for a 3-letter ISO currency code. 
     * This method will fail if this format is not a currency format, 
Connect your IDE to all the code out there  Get Codota for Java