4,549,624 th visitor since 2017.2.1 ( Today : 6016 )
Programming
No. 577
Name. swindler
Subject. 숫자를 포맷에 맞게 출력하기
Main Cate. Java
Sub Cate.
Date. 2009-02-16 17:24
Hit. 3205 (211.43.206.101)
File.
1.40f 를 "1.40" 이런식으로 고정길이에 맞춰서 출력하기 위해서는
아래와 같이 사용한다.

####.## 와 같이 하면 길이가 조정된다.


String pattern = "0000.00";

DecimalFormat dformat = new DecimalFormat( pattern );

float num = 1.40f;

System.out.println( dformat.format( num ) );

[바로가기 링크] : http://coolx.net/cboard/develop/577



Name
Password
Comment
Copyright © 1999-2017, swindler. All rights reserved. 367,611 visitor ( 1999.1.8-2004.5.26 ), 2,405,771 ( -2017.01.31)

  2HLAB   2HLAB_Blog   RedToolBox   Omil   Omil_Blog