Examples of format()


Examples of com.ibm.icu.text.DurationFormat.format()

            errln("Expected " + expect + " but got " + formatted);
        } else {
            logln("format date from -> " + formatted);
        }

        formatted = df.format(new Long(1000*3600*24*2));
        expect = "fra due giorni";
        if(!expect.equals(formatted)) {
            errln("Expected " + expect + " but got " + formatted);
        } else {
            logln("format long obj -> " + formatted);
View Full Code Here

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

        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);

            //Apply pattern without param and print the result
View Full Code Here

Examples of com.ibm.icu.text.NumberFormat.format()

    } else {
      throw new IllegalArgumentException(
          String.format("Unrecognized Number Format Type: {0}", formatType));
    }

    return toSoyData(instance.format(((NumberData) value).toFloat()));
  }


  @Override public JsExpr applyForJsSrc(JsExpr value, List<JsExpr> args) {
    String numberFormatNameJsExprText;
View Full Code Here

Examples of com.ibm.icu.text.PluralFormat.format()

        for (int n = 0; n < 200; ++n) {
          if (changes.get(new Integer(n)) != null) {
            expected = (String) changes.get(new Integer(n));
          }
          assertEquals("Locale: " + locales[i] + ", number: " + n,
                       expected, plf.format(n));
        }
      } catch (IllegalArgumentException e) {
        errln(e.getMessage() + " locale: " + locales[i] + " pattern: '" + testPattern + "' " + System.currentTimeMillis());
      }
    }
View Full Code Here

Examples of com.ibm.icu.text.RuleBasedNumberFormat.format()

            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;
    }
View Full Code Here

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

  {
    try {
      SimpleDateFormat sd = new SimpleDateFormat(formatString.getValue());
      Calendar cal = getCalendarForDate(inputDate);
      sd.setCalendar(cal);
      return values.string(sd.format(cal.getTime()));
    } catch (IllegalArgumentException iae) {
      throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print time with format " + formatString.getValue(), null, null);
    }
  }
View Full Code Here

Examples of com.ibm.icu.text.TimeUnitFormat.format()

            TimeUnitFormat tufa = (TimeUnitFormat)a;
            TimeUnitFormat tufb = (TimeUnitFormat)b;

            TimeUnitAmount amount = new TimeUnitAmount(3, TimeUnit.HOUR);
            String resa = tufa.format(amount);
            String resb = tufb.format(amount);

            return resa.equals(resb);
        }
    }
View Full Code Here

Examples of com.ibm.icu.text.TimeZoneFormat.format()

      long date = System.currentTimeMillis();
      Output<TimeType> timeType = new Output<TimeType>(TimeType.UNKNOWN);

      switch (style) {
      case GENERIC_LOCATION:
        result = tzfmt.format(Style.GENERIC_LOCATION, this, date, timeType);
        break;
      case LONG_GENERIC:
        result = tzfmt.format(Style.GENERIC_LONG, this, date, timeType);
        break;
      case SHORT_GENERIC:
View Full Code Here

Examples of com.ibm.icu.text.UFormat.format()

        // exception was thrown. If it was thrown, conclude the pattern was illegal, and return null.
        try {
            switch(type) {
                case BOOLEAN:
                    uFormat = new BooleanFormat(pattern);
                    uFormat.format(BooleanValue.TRUE.getObjectToFormat());
                    break;
                case TEXT:
                    // Dummy format so no need to check it for problems.
                    uFormat = new TextFormat();
                    break;
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.utils.ThreadSafeSimpleDateFormat.format()

  {
    @Override
    public JsonElement serialize(Date date, Type typeOfT, JsonSerializationContext context)
    {
      ThreadSafeSimpleDateFormat tsdf = new ThreadSafeSimpleDateFormat("MMM d, yyyy hh:mm:ss a 'UTC'");
      return new JsonPrimitive(tsdf.format(date));
    }
  }
  protected static class JsonArraySerializer implements JsonSerializer<JsonArray>
  {
    @Override
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.