private void appendAffix(StringBuffer buffer,String affixPattern,String expAffix,boolean localized){
  if (affixPattern == null) {
    appendAffix(buffer,expAffix,localized);
  }
 else {
    int i;
    for (int pos=0; pos < affixPattern.length(); pos=i) {
      i=affixPattern.indexOf(QUOTE,pos);
      if (i < 0) {
        appendAffix(buffer,affixPattern.substring(pos),localized);
        break;
      }
      if (i > pos) {
        appendAffix(buffer,affixPattern.substring(pos,i),localized);
      }
      char c=affixPattern.charAt(++i);
      ++i;
      if (c == QUOTE) {
        buffer.append(c);
      }
 else       if (c == CURRENCY_SIGN && i < affixPattern.length() && affixPattern.charAt(i) == CURRENCY_SIGN) {
        ++i;
        buffer.append(c);
      }
 else       if (localized) {
switch (c) {
case PATTERN_PERCENT:
          c=symbols.getPercent();
        break;
case PATTERN_PER_MILLE:
      c=symbols.getPerMill();
    break;
case PATTERN_MINUS:
  c=symbols.getMinusSign();
break;
}
}
buffer.append(c);
}
}
}

private void appendAffix ( StringBuffer buffer , String affixPattern , String expAffix , boolean localized ) { if ( affixPattern == null ) { appendAffix ( buffer , expAffix , localized ) ; } else { int i ; for ( int pos = 0 ; pos < affixPattern . length ( ) ; pos = i ) { i = affixPattern . indexOf ( QUOTE , pos ) ; if ( i < 0 ) { appendAffix ( buffer , affixPattern . substring ( pos ) , localized ) ; break ; } if ( i > pos ) { appendAffix ( buffer , affixPattern . substring ( pos , i ) , localized ) ; } char c = affixPattern . charAt ( ++ i ) ; ++ i ; if ( c == QUOTE ) { buffer . append ( c ) ; } else if ( c == CURRENCY_SIGN && i < affixPattern . length ( ) && affixPattern . charAt ( i ) == CURRENCY_SIGN ) { ++ i ; buffer . append ( c ) ; } else if ( localized ) { switch ( c ) { case PATTERN_PERCENT : c = symbols . getPercent ( ) ; break ; case PATTERN_PER_MILLE : c = symbols . getPerMill ( ) ; break ; case PATTERN_MINUS : c = symbols . getMinusSign ( ) ; break ; } } buffer . append ( c ) ; } } }
appends an affix pattern to the given stringbuffer , quoting special characters as needed . uses the internal affix pattern , if that exists , or the literal affix , if the internal affix pattern is null . the appended string will generate the same affix pattern ( or literal affix ) when passed to topattern ( ) .
