查找字符串数组是否包含某个字符串


public static void main(String[] args) {
    String str = "Hello,World,Good,Night";
    String[] arr = str.split(",");
    boolean flag = Arrays.asList(arr).contains("Hello");
    System.out.println(flag);
}

你可能感兴趣的:(Arrays)