i have an int (unknown lenght) that i need to format so there's a comma every 3 digits, like "1,000,203,2203". I know about DecimalFormat df1 = new DecimalFormat(), but I'm not quite sure what to put in the parentheses. If I knew the int was 4 digits, I could do "0,000", but I'm not sure how to go about formatting an unknown number of digits. Let me know! Thanks!
posted 11 years ago
You're on the right track, just use #'s instead of 0's in you DecimalFormatter, like this: If the number is more than 6 digits, it will automatically stick in another "," at the right places so you don't have to guess at the size. Try it out and you'll see what I mean.
Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"