Java Array Contain arrayContainsPartKey(String[] array, String key)

Here you can find the source of arrayContainsPartKey(String[] array, String key)

Description

Method to find if the given key is part of any of the array values

e.g.

License

LGPL

Parameter

Parameter Description
array Array to be scanned
key key

Return

boolean true if partial key is found

Declaration

public static boolean arrayContainsPartKey(String[] array, String key) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    /**//from  w w w  .ja  v  a2 s  . c  o m
     * Method to find if the given key is part of any of the array values
     * <p>
     * e.g. if array contains <i>"abc"</i> and given key is <i>"abcdef"</i>; true is returned
     * </p>
     * 
     * @param array
     *            Array to be scanned
     * @param key
     *            key
     * @return boolean true if partial key is found
     */
    public static boolean arrayContainsPartKey(String[] array, String key) {
        for (String string : array) {
            if (key.indexOf(string) != -1) {
                return true;
            }
        }
        return false;
    }
}

Related

  1. arrayContainsLower(String[] lemmas, String string)
  2. arrayContainsNumber(Number[] array, Number number)
  3. arrayContainsOK(final byte[] b)
  4. arrayContainsOnlyIgnoreCase(String[] array, String... strs)
  5. arrayContainsOverlap(Object[] array1, Object[] array2)
  6. arrayContainsString(String[] arr, String str, boolean isCaseSensitive)
  7. arrayContainString(String[] arrayString, String str)
  8. arrayIntContainsInt(int[] arrayInt, int value)