To determine whether a string contains some characters in Java, the same requirement also exists in js. The following is the source code used to determine whether a string contains characters:
Package com. evantj. test; public class DateTEST {public static void main (String [] args) {String src = "98-2-2"; String dest = "-"; System. out. println (indexOfString (src, dest);}/** determine whether the String contains some characters contains */public static boolean containsString (String src, String dest) {boolean flag = false; if (src. contains (dest) {flag = true;} return flag;}/** determines whether the string contains some characters indexOf */public static boolean indexOfStrin G (String src, String dest) {boolean flag = false; if (src. indexOf (dest )! =-1) {flag = true;} return flag ;}}In js, indexOf is used to determine whether a string contains another string.
Zookeeper