Examples of applyPattern()


Examples of com.ibm.icu.text.DecimalFormat.applyPattern()

            "0.0",
            "#000.0"         
        };
       
        for(int i=0; i < patterns.length; i++) {
            df.applyPattern(patterns[i]);
            numstr = df.format(5);       
            try {
                Number n = df.parse(numstr);
                logln("INFO: Parsed " + numstr + " -> " + n);
            } catch (ParseException pe) {
View Full Code Here

Examples of com.ibm.icu.text.MessageFormat.applyPattern()

        MessageFormat messageFormatter = new MessageFormat("");

        try {
            //Apply pattern with param and print the result
            messageFormatter.applyPattern(pattern[1]);
            Object[] paramArray = {new String("BUG"), new Date()};
            String tempBuffer = messageFormatter.format(paramArray);
            if (!tempBuffer.equals("Message with param:BUG"))
                errln("MessageFormat with one param test failed.");
            logln("Formatted with one extra param : " + tempBuffer);
View Full Code Here

Examples of com.ibm.icu.text.SimpleDateFormat.applyPattern()

        if (pattern != null)
            // Note: this was previously using applyLocalizedPattern() which allows to use
            // a locale-specific pattern syntax, e.g. in french "j" (jour) for "d" and
            // "a" (annee) for "y". But the localized pattern syntax is very little known and thus
            // led to some weird pattern syntax error messages.
            dateFormat.applyPattern(pattern);
        else if (nonLocalizedPattern != null)
            dateFormat.applyPattern(nonLocalizedPattern);

        return dateFormat;
    }
View Full Code Here

Examples of com.ibm.icu.text.UnicodeSet.applyPattern()

            /* build a set with all code points that were not designated by the specified Unicode version */
            UnicodeSet set = new UnicodeSet();

            switch(options) {
            case Normalizer.UNICODE_3_2:
                set.applyPattern("[:^Age=3.2:]");
                break;
            default:
                return null;
            }
           
View Full Code Here

Examples of java.text.ChoiceFormat.applyPattern()

      harness.check (doformat (cf, 1.5, buf), "Sun");
      harness.check (doformat (cf, 5.5, buf), "Thu");
      harness.check (doformat (cf, 7.0, buf), "Sat");
      harness.check (doformat (cf, 99.5, buf), "Sat");

      cf.applyPattern ("-1.0#Less than one|1.0#One|1.0<One to two, exclusive|2.0#Two to three, inclusive|3.0<Over three, up to four|4.0<Four to five, exclusive|5.0#Five and above");
      harness.check (doformat (cf, -23, buf), "Less than one");
      harness.check (doformat (cf, -.5, buf), "Less than one");
      harness.check (doformat (cf, ChoiceFormat.previousDouble (1.0), buf),
         "Less than one");
      harness.check (doformat (cf, 1.0, buf), "One");
View Full Code Here

Examples of java.text.DecimalFormat.applyPattern()

  public Object createObject()
  {
    final DecimalFormat format = (DecimalFormat) super.createObject();
    if (getParameter("pattern") != null)
    {
      format.applyPattern((String) getParameter("pattern"));
    }
//        if (getParameter("localizedPattern") != null) {
//            format.applyLocalizedPattern((String) getParameter("localizedPattern"));
//        }
    return format;
View Full Code Here

Examples of java.text.DecimalFormat.applyPattern()

      stop();
      long elapsed = elapsed();
      double perMilli = (double)iterations / (double)elapsed;
      DecimalFormat df = ((DecimalFormat)NumberFormat.getInstance());
      if (perMilli > 10000.) {
         df.applyPattern("########");
         return Timestamp.millisToNice(elapsed) + " for " + iterations + " iterations -> " + df.format(perMilli/1000) + " iterations/microsecond";
      }
      else if (perMilli > 100.)
         df.applyPattern("########");
      else if (perMilli > 10.)
View Full Code Here

Examples of java.text.DecimalFormat.applyPattern()

      if (perMilli > 10000.) {
         df.applyPattern("########");
         return Timestamp.millisToNice(elapsed) + " for " + iterations + " iterations -> " + df.format(perMilli/1000) + " iterations/microsecond";
      }
      else if (perMilli > 100.)
         df.applyPattern("########");
      else if (perMilli > 10.)
         df.applyPattern("######.#");
      else if (perMilli > 0.1) {
         df.applyPattern("######.#");
         return Timestamp.millisToNice(elapsed) + " for " + iterations + " iterations -> " + df.format(perMilli*1000) + " iterations/second";
View Full Code Here

Examples of java.text.DecimalFormat.applyPattern()

         return Timestamp.millisToNice(elapsed) + " for " + iterations + " iterations -> " + df.format(perMilli/1000) + " iterations/microsecond";
      }
      else if (perMilli > 100.)
         df.applyPattern("########");
      else if (perMilli > 10.)
         df.applyPattern("######.#");
      else if (perMilli > 0.1) {
         df.applyPattern("######.#");
         return Timestamp.millisToNice(elapsed) + " for " + iterations + " iterations -> " + df.format(perMilli*1000) + " iterations/second";
      }
      else {
View Full Code Here

Examples of java.text.DecimalFormat.applyPattern()

      else if (perMilli > 100.)
         df.applyPattern("########");
      else if (perMilli > 10.)
         df.applyPattern("######.#");
      else if (perMilli > 0.1) {
         df.applyPattern("######.#");
         return Timestamp.millisToNice(elapsed) + " for " + iterations + " iterations -> " + df.format(perMilli*1000) + " iterations/second";
      }
      else {
         df.applyPattern("##########");
         return Timestamp.millisToNice(elapsed) + " for " + iterations + " iterations -> " + df.format(perMilli*1000) + " iterations/second";
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.