List of usage examples for java.text FieldPosition FieldPosition
public FieldPosition(Format.Field attribute)
From source file:Main.java
public static void main(String[] args) throws Exception { NumberFormat numberFormat = NumberFormat.getPercentInstance(); StringBuffer sb = new StringBuffer(); numberFormat.format(111L, sb, new FieldPosition(0)); System.out.println(sb);//ww w . java2 s . com }
From source file:Main.java
public static void main(String[] args) throws Exception { NumberFormat numberFormat = NumberFormat.getPercentInstance(); StringBuffer sb = new StringBuffer(); numberFormat.format(2.234, sb, new FieldPosition(0)); System.out.println(sb);//w w w .j a v a 2 s . c o m }
From source file:Main.java
public static void main(String[] argv) throws Exception { DateFormat dateFormat = DateFormat.getDateInstance(); StringBuffer sb = new StringBuffer(); sb = dateFormat.format(new Date(), sb, new FieldPosition(DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD)); System.out.println(sb);/*from w w w . j a v a 2 s.co m*/ }
From source file:Main.java
public static void main(String[] args) throws Exception { NumberFormat numberFormat = NumberFormat.getPercentInstance(); StringBuffer sb = new StringBuffer(); Object value = 111L;/*from ww w .j ava2 s . c om*/ numberFormat.format(value, sb, new FieldPosition(0)); System.out.println(sb); }
From source file:Main.java
public static void main(String[] args) throws Exception { NumberFormat numberFormat = NumberFormat.getPercentInstance(); StringBuffer sb = new StringBuffer(); Object value = 11.111;// w w w . j a va2 s . c o m numberFormat.format(value, sb, new FieldPosition(NumberFormat.FRACTION_FIELD)); System.out.println(sb); }
From source file:Main.java
public static void main(String[] argv) throws Exception { SimpleDateFormat formatter = new SimpleDateFormat(); StringBuffer sb = new StringBuffer(); formatter.format(new Date(), sb, new FieldPosition(DateFormat.DATE_FIELD)); System.out.println(sb);/* w ww .j a v a 2 s. c o m*/ }
From source file:Main.java
public static void main(String args[]) { int days = 1; int month = 1; int year = 2001; SimpleDateFormat sdf = new SimpleDateFormat("E dd-MM-yyyy G"); StringBuffer buf = new StringBuffer(); Calendar cal = new GregorianCalendar(); cal.set(year, month - 1, days);/*from w ww. ja v a 2 s. co m*/ sdf.format(cal.getTime(), buf, new FieldPosition(10)); System.out.println(buf.toString()); }
From source file:TempConverter3.java
public TempConverter3() { super();//w w w . ja va2 s .com dff = new DecimalFormat("#0.0"); fp = new FieldPosition(NumberFormat.INTEGER_FIELD); }
From source file:com.rsmart.kuali.kfs.fp.batch.DisbursementVoucherInputFileType.java
/** * @see org.kuali.kfs.sys.batch.BatchInputFileType#getFileName(java.lang.String, java.lang.Object, java.lang.String) *//*from ww w . ja va 2 s .c om*/ public String getFileName(String principalId, Object parsedFileContents, String fileUserIdentifer) { Timestamp currentTimestamp = dateTimeService.getCurrentTimestamp(); StringBuffer buf = new StringBuffer(); SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd_HHmmss"); formatter.setLenient(false); formatter.format(currentTimestamp, buf, new FieldPosition(0)); String fileName = FPConstants.DV_FILE_UPLOAD_FILE_PREFIX + principalId; if (StringUtils.isNotBlank(fileUserIdentifer)) { fileName += "_" + StringUtils.remove(fileUserIdentifer, " "); } fileName += "_" + buf.toString(); return fileName; }
From source file:com.anrisoftware.globalpom.format.point.PointFormat.java
private void formatPoint(StringBuffer buff, Point2D point) { buff.append("("); numberFormat.format(point.getX(), buff, new FieldPosition(0)); buff.append(", "); numberFormat.format(point.getY(), buff, new FieldPosition(0)); buff.append(")"); }