1. First turn the string into a string array
2. Convert string array to List collection
3. Use the contains() method in the List collection to determine whether it contains a certain number
@Test public void test2222(){ String ids = "1,2,3,45,35"; String[] values = ids.split(","); List<String> list = Arrays.asList(values); if(list.contains("4")){ System.out.println("true"); }else { System.out.println("false"); } }The above example of whether a comma-separated string contains a certain number is the entire content I share with you. I hope it can give you a reference and I hope you can support Wulin.com more.