Search string In string array - Android java.lang

Android examples for java.lang:array

Description

Search string In string array

Demo Code

public class Main{

    public static boolean isIn(String substring, String[] source) {
        if (source == null || source.length == 0) {
            return false;
        }/*w  w  w  .  j  av  a2s  .  co  m*/
        for (int i = 0; i < source.length; i++) {
            String aSource = source[i];
            if (aSource.equals(substring)) {
                return true;
            }
        }
        return false;
    }

}

Related Tutorials