-
[JSP] 형변환case Computer : 2009. 6. 7. 15:221. int --> String
int i = 2;
String s = Integer.toString(i);
2. String -> int
String s = "1234";
int i = Integer.parseInt(s);
3. double --> String
double d = 2.34;
String s = Integer.toString(d);
4. String --> double
String s = "2.34";
double d = Double.valueOf(s).doubleValue();
5. float --> String
float f = 0.234F;
String s = Float.toString(f);
6. String --> float
String s = "0.234F";
float f = Float.valueOf(s).floatValue();
7. long --> String
long l = 123456L;
String s = Long.toString(l);
8. String --> long
String s = "123456";
long l = Long.parseLong(s);
9. int --> 16
int i = 12;
String hex = Integer.toHexString(i);
10. 16 --> int
String hex = "ABCD";
int i = Integer.parseInt(hex, 16);
반응형'case Computer :' 카테고리의 다른 글
windows prorocess list view command (0) 2009.06.11 [MS 보안업데이트]2009년 6월 MS 정기 보안업데이트 권고 (0) 2009.06.10 [MY-SQL] 정보 대량 입력 (0) 2009.06.03 [MS-SQL] 시간 관련 함수 (0) 2009.06.03 [My-SQL] fild 수정 (0) 2009.06.03