判断字符串中含有逗号,并移除

if(amount.length()>0 && amount.indexOf(",") >= 0) {
            amount = amount.replaceAll(",", "");
        }

java中经常会遇到字符串的拼接:

1、StringBuilder sb = new StringBuilder();

  String[] b = new String()[3];

 for(int i = 0; i<3; i++){

  if(i==0){

    sb.append("b[i]");

  }else{

    sb.append(",").append("b[i]");

  }  

}

sb = sb.substring(0,sb.length()-1);

原文地址:https://www.cnblogs.com/lius1/p/4434303.html