package com.example.demo.test;
public class souths {
static Strings="";
public static void main(String[] args) {
String str="123213123.416546";
String 整数="";
String 小数="";
if(str.contains(".")){
String[] s = str.split("\\.");
整数=s[0];
小数="."+s[1];
}else {
整数=str;
}
int le=整数.length()%3;
String stater="";
if(le!=0){
stater = 整数.substring(0,le)+",";
}
String substring = 整数.substring(le);
String jie =jie(substring);
if(jie.equals("")){
stater = stater.substring(0,stater.length() -1);
}else {
jie = jie.substring(0,jie.length() -1);
}
System.out.println(stater+jie+小数);
}
public static String jie(String str){
if(str.length()<3){
return str;
}
String substring = str.substring(0,3);
String shen=str.substring(3);
s+=substring+",";
if(shen.length()<3){
return s;
}else {
jie(shen);
}
return s;
}
}