public Coin parse(String source, ParsePosition pos) {
        DecimalFormatSymbols anteSigns = null;
        int parseScale = COIN_SCALE; // default
        Coin coin = null;
        synchronized (numberFormat) {
            if (numberFormat.toPattern().contains("¤")) {
                for(ScaleMatcher d : denomMatchers()) {
                    Matcher matcher = d.pattern.matcher(source);
                    if (matcher.find()) {
                        anteSigns = setSymbolAndCode(numberFormat, matcher.group());
                        parseScale = d.scale;
                        break;
                    }
                }
                if (parseScale == COIN_SCALE) {
                    Matcher matcher = coinPattern.matcher(source);
                    matcher.find();
                    anteSigns = setSymbolAndCode(numberFormat, matcher.group());
                }
            } else parseScale = scale();

            Number number = numberFormat.parse(source, pos);
            if (number != null) try {
                    coin = Coin.valueOf(
                        ((BigDecimal)number).movePointRight(offSatoshis(parseScale)).setScale(0, HALF_UP).longValue()
                    );
                } catch (IllegalArgumentException e) {
                    pos.setIndex(0);
                }
            if (anteSigns != null) numberFormat.setDecimalFormatSymbols(anteSigns);
        }
        return coin;
    }
public Coin parse ( String source , ParsePosition pos ) { DecimalFormatSymbols anteSigns = null ; int parseScale = COIN_SCALE ; Coin coin = null ; synchronized ( numberFormat ) { if ( numberFormat . toPattern ( ) . contains ( "¤" ) ) { for ( ScaleMatcher d : denomMatchers ( ) ) { Matcher matcher = d . pattern . matcher ( source ) ; if ( matcher . find ( ) ) { anteSigns = setSymbolAndCode ( numberFormat , matcher . group ( ) ) ; parseScale = d . scale ; break ; } } if ( parseScale == COIN_SCALE ) { Matcher matcher = coinPattern . matcher ( source ) ; matcher . find ( ) ; anteSigns = setSymbolAndCode ( numberFormat , matcher . group ( ) ) ; } } else parseScale = scale ( ) ; Number number = numberFormat . parse ( source , pos ) ; if ( number != null ) try { coin = Coin . valueOf ( ( ( BigDecimal ) number ) . movePointRight ( offSatoshis ( parseScale ) ) . setScale ( 0 , HALF_UP ) . longValue ( ) ) ; } catch ( IllegalArgumentException e ) { pos . setIndex ( 0 ) ; } if ( anteSigns != null ) numberFormat . setDecimalFormatSymbols ( anteSigns ) ; } return coin ; }
Parse a {@link String} representation of a Bitcoin monetary value.  If this
object's pattern includes a currency sign, either symbol or code, as by default is true
for instances of {@link BtcAutoFormat} and false for instances of {@link
BtcFixedFormat}, then denominated (i.e., prefixed) currency signs in the parsed String
will be recognized, and the parsed number will be interpreted as a quantity of units
having that recognized denomination.
<p>If the pattern includes a currency sign but no currency sign is detected in the parsed
String, then the number is interpreted as a quatity of bitcoins.
<p>If the pattern contains neither a currency symbol nor sign, then instances of {@link
BtcAutoFormat} will interpret the parsed number as a quantity of bitcoins, and instances
of {@link BtcAutoFormat} will interpret the number as a quantity of that instance's
configured denomination, which can be ascertained by invoking the {@link
BtcFixedFormat#symbol()} or {@link BtcFixedFormat#code()} method.

<p>Consider using the single-argument version of this overloaded method unless you need to
keep track of the current parse position.

@return a Coin object representing the parsed value
@see java.text.ParsePosition