private FieldPosition[] expandAffix(String pattern){
  ArrayList<FieldPosition> positions=null;
  int stringIndex=0;
  for (int i=0; i < pattern.length(); ) {
    char c=pattern.charAt(i++);
    if (c == QUOTE) {
      int field=-1;
      Format.Field fieldID=null;
      c=pattern.charAt(i++);
switch (c) {
case CURRENCY_SIGN:
        String string;
      if (i < pattern.length() && pattern.charAt(i) == CURRENCY_SIGN) {
        ++i;
        string=symbols.getInternationalCurrencySymbol();
      }
 else {
        string=symbols.getCurrencySymbol();
      }
    if (string.length() > 0) {
      if (positions == null) {
        positions=new ArrayList<>(2);
      }
      FieldPosition fp=new FieldPosition(Field.CURRENCY);
      fp.setBeginIndex(stringIndex);
      fp.setEndIndex(stringIndex + string.length());
      positions.add(fp);
      stringIndex+=string.length();
    }
  continue;
case PATTERN_PERCENT:
c=symbols.getPercent();
field=-1;
fieldID=Field.PERCENT;
break;
case PATTERN_PER_MILLE:
c=symbols.getPerMill();
field=-1;
fieldID=Field.PERMILLE;
break;
case PATTERN_MINUS:
c=symbols.getMinusSign();
field=-1;
fieldID=Field.SIGN;
break;
}
if (fieldID != null) {
if (positions == null) {
positions=new ArrayList<>(2);
}
FieldPosition fp=new FieldPosition(fieldID,field);
fp.setBeginIndex(stringIndex);
fp.setEndIndex(stringIndex + 1);
positions.add(fp);
}
}
stringIndex++;
}
if (positions != null) {
return positions.toArray(EmptyFieldPositionArray);
}
return EmptyFieldPositionArray;
}

private FieldPosition [ ] expandAffix ( String pattern ) { ArrayList < FieldPosition > positions = null ; int stringIndex = 0 ; for ( int i = 0 ; i < pattern . length ( ) ; ) { char c = pattern . charAt ( i ++ ) ; if ( c == QUOTE ) { int field = - 1 ; Format . Field fieldID = null ; c = pattern . charAt ( i ++ ) ; switch ( c ) { case CURRENCY_SIGN : String string ; if ( i < pattern . length ( ) && pattern . charAt ( i ) == CURRENCY_SIGN ) { ++ i ; string = symbols . getInternationalCurrencySymbol ( ) ; } else { string = symbols . getCurrencySymbol ( ) ; } if ( string . length ( ) > 0 ) { if ( positions == null ) { positions = new ArrayList < > ( 2 ) ; } FieldPosition fp = new FieldPosition ( Field . CURRENCY ) ; fp . setBeginIndex ( stringIndex ) ; fp . setEndIndex ( stringIndex + string . length ( ) ) ; positions . add ( fp ) ; stringIndex += string . length ( ) ; } continue ; case PATTERN_PERCENT : c = symbols . getPercent ( ) ; field = - 1 ; fieldID = Field . PERCENT ; break ; case PATTERN_PER_MILLE : c = symbols . getPerMill ( ) ; field = - 1 ; fieldID = Field . PERMILLE ; break ; case PATTERN_MINUS : c = symbols . getMinusSign ( ) ; field = - 1 ; fieldID = Field . SIGN ; break ; } if ( fieldID != null ) { if ( positions == null ) { positions = new ArrayList < > ( 2 ) ; } FieldPosition fp = new FieldPosition ( fieldID , field ) ; fp . setBeginIndex ( stringIndex ) ; fp . setEndIndex ( stringIndex + 1 ) ; positions . add ( fp ) ; } } stringIndex ++ ; } if ( positions != null ) { return positions . toArray ( EmptyFieldPositionArray ) ; } return EmptyFieldPositionArray ; }
expand an affix pattern into an array of fieldpositions describing how the pattern would be expanded . all characters in the pattern are literal unless prefixed by quote . the following characters after quote are recognized : pattern_percent , pattern_per_mille , pattern_minus , and currency_sign . if currency_sign is doubled ( quote + currency_sign + currency_sign ) , it is interpreted as an iso 4217 currency code . any other character after a quote represents itself . quote must be followed by another character ; quote may not occur by itself at the end of the pattern .
