Examples of applyPattern()


Examples of java.text.DecimalFormat.applyPattern()

        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

Examples of java.text.DecimalFormat.applyPattern()

      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

Examples of java.text.DecimalFormat.applyPattern()

          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

Examples of java.text.DecimalFormat.applyPattern()

        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

Examples of java.text.DecimalFormat.applyPattern()

            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

Examples of java.text.DecimalFormat.applyPattern()

    }

    public static String format(final long number, final String conversionPattern) {
        DecimalFormat df = DECIMAL_FORMAT.get();
        if (conversionPattern != null) {
            df.applyPattern(conversionPattern);
        }
        return df.format(number);
    }

    public static String format(final double number) {
View Full Code Here

Examples of java.text.DecimalFormat.applyPattern()

    }

    public static String format(final double number, final String conversionPattern) {
        DecimalFormat df = DECIMAL_FORMAT.get();
        if (conversionPattern != null) {
            df.applyPattern(conversionPattern);
        }
        return df.format(number);
    }

    public static Date parseDate(final String source) throws ParseException {
View Full Code Here

Examples of java.text.DecimalFormat.applyPattern()

        return sdf.parse(source);
    }

    public static Number parseNumber(final String source, final String conversionPattern) throws ParseException {
        DecimalFormat df = DECIMAL_FORMAT.get();
        df.applyPattern(conversionPattern);
        return df.parse(source);
    }

    public static void clear() {
        DATE_FORMAT.remove();
View Full Code Here

Examples of java.text.MessageFormat.applyPattern()

      defaultVal = key;
    }
    if (null == text && defaultVal != null) {
      MessageFormat format = new MessageFormat(defaultVal);
      format.setLocale(getLocale());
      format.applyPattern(defaultVal);
      return format.format(args);
    }
    return text;
  }
View Full Code Here

Examples of java.text.MessageFormat.applyPattern()

  public String getText(String key, Object[] args) {
    String text = bundle.getString(key);
    MessageFormat format = new MessageFormat(text);
    format.setLocale(locale);
    format.applyPattern(text);
    return format.format(args);
  }

  public void setLocale(Locale locale) {
    this.locale = locale;
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.