[JAVA] addComma 3자리 콤마 표기


[JAVA] addComma 3자리 콤마 표기

#콤마 #세자리 #3자리 #숫자표기 #숫자 #쉼표표기 #쉼표 public static String addComma(String str) { boolean isMinus = false; if (str != null && !

str.equals("")) { int j = 0, index = 0; String str_new = ""; // -부호 제외 /* if (str.indexOf("-") != -1) { str = str.replace("-", ""); isMinus = true; } */ if (str.indexOf('.') == -1) index = str.length() - 1; else index = str.indexOf('.') - 1; for (int i = index; i >= 0; i--, j++) { if (j !

= 0 && (j % 3) == 0) str_new = ',' + str_new; str_new = str.charAt(i) + str_new; } str_n...


#3자리 #세자리 #숫자 #숫자표기 #쉼표 #쉼표표기 #컴마 #콤마

원문링크 : [JAVA] addComma 3자리 콤마 표기