Package java.text

Examples of java.text.Format.format()


    String render_file = asciidoctor.render(toString(content), options);

    Format TIME_FORMAT = new SimpleDateFormat("HH:mm:ss z");

    assertRenderedLocalDateContent(render_file, TIME_FORMAT.format(customTime.getTime()) + ".");

  }

  @Test
  public void string_content_document_should_be_rendered_into_default_backend() throws IOException, SAXException,
View Full Code Here


        // should return the Date according to the provided format

        if (SynapseConstants.SYSTEM_DATE.equals(key)) {
            if (dateformat != null) {
                Format formatter = new SimpleDateFormat(dateformat.toString());
                return formatter.format(new java.util.Date());
            } else {
                Format formatter = new SimpleDateFormat();
                return formatter.format(new java.util.Date());
            }
        }
View Full Code Here

            if (dateformat != null) {
                Format formatter = new SimpleDateFormat(dateformat.toString());
                return formatter.format(new java.util.Date());
            } else {
                Format formatter = new SimpleDateFormat();
                return formatter.format(new java.util.Date());
            }
        }

        //return the current system time as a string , don't care scope
        if (SynapseConstants.SYSTEM_TIME.equals(key)) {
View Full Code Here

        // Get a new format each time, because (a) have to account for locale and (b) formatters are
        // not thread safe.

        Format format = getFormat(field.getPage().getLocale());

        return format.format(object);
    }

    /**
     * @see org.apache.tapestry.form.translator.AbstractTranslator#parseText(org.apache.tapestry.form.IFormComponent,
     *      java.lang.String)
View Full Code Here

        }}
        else{
        {
            __CLOVER_67_0.S[1516]++;try
            {
                __CLOVER_67_0.S[1517]++;insert = format.format(value);
            }
            catch (Exception ex)
            {
                __CLOVER_67_0.S[1518]++;throw new ApplicationRuntimeException(
                    Tapestry.format("Insert.unable-to-format", value),
View Full Code Here

        // Get a new format each time, because (a) have to account for locale and (b) formatters are
        // not thread safe.

        Format format = getFormat(field.getPage().getLocale());

        return format.format(object);
    }

    /**
     * @see org.apache.tapestry.form.translator.AbstractTranslator#parseText(org.apache.tapestry.form.IFormComponent,
     *      java.lang.String)
View Full Code Here

            Format f = (displayFormat != null ? displayFormat : editFormat);
            if (f == null)
                formattedValue = ObjectUtils.toString(value);
            else {
                try {
                    formattedValue = f.format(value);
                }
                catch (Exception ex) {
                    formattedValue = "";
                }
            }
View Full Code Here

            }
        }

        if( format!=null )
                return format.format( value );
        else
                return value.toString();

    }
View Full Code Here

        Format numberFormat = getFormat(cell);
        double d = cell.getNumericCellValue();
        if (numberFormat == null) {
            return String.valueOf(d);
        }
        return numberFormat.format(new Double(d));
    }

    /**
     * Formats the given raw cell value, based on the supplied
     *  format index and string, according to excel style rules.
View Full Code Here

            Format numberFormat = getFormat(value, formatIndex, formatString);
            if (numberFormat == null) {
                return String.valueOf(value);
            }
            // RK: This hack handles scientific notation by adding the missing + back.
            String result = numberFormat.format(new Double(value));
            if (result.contains("E") && !result.contains("E-")) {
                result = result.replaceFirst("E", "E+");
            }
            return result;
    }
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.