Package java.text

Examples of java.text.DecimalFormat.applyPattern()


      DecimalFormat retVal = new DecimalFormat();
      try {
        if(arg0!=null && arg0.length()>0){
          retVal.applyPattern(arg0.replaceAll("#", "0"));
        }else{
          retVal.applyPattern("00000");
        }
    } catch (Exception fe) {
      retVal.applyPattern("00000");
    }
    return retVal;
View Full Code Here


          retVal.applyPattern(arg0.replaceAll("#", "0"));
        }else{
          retVal.applyPattern("00000");
        }
    } catch (Exception fe) {
      retVal.applyPattern("00000");
    }
    return retVal;
    }
}
View Full Code Here

        }

        String pattern = (String)localizedPatterns.get(locale);

        if (pattern != null) {
            decimalFormat.applyPattern(pattern);
        } else if (nonLocalizedPattern != null) {
            decimalFormat.applyPattern(nonLocalizedPattern);
        }
        return decimalFormat;
    }
View Full Code Here

        String pattern = (String)localizedPatterns.get(locale);

        if (pattern != null) {
            decimalFormat.applyPattern(pattern);
        } else if (nonLocalizedPattern != null) {
            decimalFormat.applyPattern(nonLocalizedPattern);
        }
        return decimalFormat;
    }

    public void setVariant(int variant) {
View Full Code Here

      DecimalFormat df = (DecimalFormat)nf;
      df.setMinimumFractionDigits(2);
      df.setMaximumFractionDigits(2);
      df.setDecimalSeparatorAlwaysShown(true);
      String pattern = "$###,###.00";
      df.applyPattern(pattern);
      return df.format(amount);
   }
}
View Full Code Here

        format = NumberFormat.getInstance();

      DecimalFormat decimalFormat = (DecimalFormat) format;

      if (_pattern != null)
        decimalFormat.applyPattern(_pattern);
    }
    else if (type.equals("percent")) {
      if (locale != null)
        format = NumberFormat.getPercentInstance(locale);
      else
View Full Code Here

      throw new JspException(L.l("unknown formatNumber type `{0}'", _type));

    if (_pattern != null) {
      DecimalFormat decimalFormat = (DecimalFormat) format;

      decimalFormat.applyPattern(_pattern);
    }

    format.setParseIntegerOnly(_integerOnly);

    return format;
View Full Code Here

          format = NumberFormat.getInstance();

        DecimalFormat decimalFormat = (DecimalFormat) format;

        if (_patternExpr != null)
          decimalFormat.applyPattern(_patternExpr.evalString(env));
      }
      else if (type.equals("percent")) {
        if (locale != null)
          format = NumberFormat.getPercentInstance(locale);
        else
View Full Code Here

        format = NumberFormat.getInstance();

      DecimalFormat decimalFormat = (DecimalFormat) format;

      if (_patternExpr != null)
        decimalFormat.applyPattern(_patternExpr.evalString(env));
    }
    else if (type.equals("percent")) {
      if (locale != null)
        format = NumberFormat.getPercentInstance(locale);
      else
View Full Code Here

            for (int i = 0; i < pattern.length(); i++) {
                if (pattern.charAt(i) != CURRENCY_SYMBOL) {
                    buffer.append(pattern.charAt(i));
                }
            }
            decimalFormat.applyPattern(buffer.toString());
            parsedValue = super.parse(value, decimalFormat);
        }
        return parsedValue;
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.