public class test
{
public static void main(String[] args)
{
String abra = "100000";
abra = abra.replace(abra.substring(abra.length() - 3),
"," + abra.substring(abra.length() - 3));
System.out.println(abra);
}
}
Totally new to java and i'm trying to replace a number with comma to separate the zeros by three. It works fine for thousands and ten thousands, but i'm getting wierd results for more. Any ideas?
Thanks in advance!