判断字符串是否包含特殊符号

时间:2025-05-15 12:10:32
//英文分号
String itmw=“avc;sdf”;
//中文分号
//String item=“avc;sdf”;
//indexOf的返回值为int,在字符串中寻找一个字的位置,也可以作为判断,该字的位置存在则正数,不存在则负数
//英文分号
 int en = (";");
//中文分号
 int ch = (";");
if(on1 !=-1){
//将分号转为逗号
String essone = (";",",");
  ....  
const en=(';')
const ch=(';')
                    if ( == '' &&  == '') {
                        this.$('请填写商品类型的数量')
                    } else if(en==-1 && ch==-1  ) {
                        this.$('请以正确格式填写设备号')
                    }else { }