public static String formatRuleBasedAmount(double amount,String rule,Locale locale){
  String ruleSet=rbnfRuleSets.get(locale);
  if (ruleSet == null) {
    Debug.logWarning("Cannot format rule based amount for locale " + locale.toString() + " because rule set for that locale does not exist",module);
    return "";
  }
  RuleBasedNumberFormat formatter=new RuleBasedNumberFormat(ruleSet,locale);
  String result="";
  try {
    result=formatter.format(amount,rule);
  }
 catch (  Exception e) {
    Debug.logError(e,"Failed to format amount " + amount + " using rule "+ rule,module);
  }
  return result;
}

public static String formatRuleBasedAmount ( double amount , String rule , Locale locale ) { String ruleSet = rbnfRuleSets . get ( locale ) ; if ( ruleSet == null ) { Debug . logWarning ( "Cannot format rule based amount for locale " + locale . toString ( ) + " because rule set for that locale does not exist" , module ) ; return "" ; } RuleBasedNumberFormat formatter = new RuleBasedNumberFormat ( ruleSet , locale ) ; String result = "" ; try { result = formatter . format ( amount , rule ) ; } catch ( Exception e ) { Debug . logError ( e , "Failed to format amount " + amount + " using rule " + rule , module ) ; } return result ; }
method to format an amount using a custom rule set . current rule sets available : en_us % dollars - and - cents - 1 , 225 . 25 becomes " one thousand two hundred twenty five dollars and twenty five cents " ( useful for checks ) % dollars - and - hundreths - 1 , 225 . 25 becomes " one thousand two hundred twenty five and 25 / 00 " ( alternate for checks )
