判断一个字符串是否在否个字符串中

  //如果该该患者和医生建立的关系,不进行操作
                String[] split = docPatientChat.getPatienIds().split(",");
                String ch = chat.getPatienIds();
                boolean contains1 = Arrays.asList(split).contains(ch);
                if(contains1){
                    System.out.println("已经存在");
                }else{
                    System.out.println("不存在");
                    StringBuilder str=new StringBuilder();
                    str.append(docPatientChat.getPatienIds()).append(",").append(chat.getPatienIds());
                    chat.setPatienIds(str.toString());
                    chatMapper.updateByDocId(chat);
                }

版权声明:本文为qq_43049310原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。