关于字符串中含有中英文逗号,分号获取,判断并转换

//英文分号
String ess=“avc;sdf”;
//中文分号
//String ess=“avc;sdf”;
//indexOf的返回值为int,在字符串中寻找一个字的位置,也可以作为判断,该字的位置存在则正数,不存在则负数
//英文分号
 int on1 = ess.indexOf(";");
//中文分号
 int on2 = ess.indexOf("");
if(on1 !=-1){
//将分号转为逗号
String essone = ess.replace(";",",");
  ....  
}else if (on2 !=-1){
  ....  
}else{
  ....
}

 

posted @ 2019-05-28 16:10  闫超辉  阅读(2239)  评论(0编辑  收藏  举报