[Java] String.format 을 이용한 문자열 형식 설정하기
public static String format(String format, Object... args); public static String format(Locale l, String format, Object... args); String 의 static 메서드인 format 메서드는 문자열의 형식을 설정하는 메서드입니다. %d (10진수 형식) %s (문자열 형식) %f (실수형 형식) Locale 설정 %t (날짜시간 형식) %c (유니코드 문자 형식) %o, %x(8진수, 16진수 형식) 1. %d (= Integer Formatting) 10진수 integer의 형식을 설정할 때 이용합니다. int i = 23; System.out.println(String.format("%d_", i));..
2020. 4. 2. 16:19