Here you can find the source of arrayContainsString(String[] arr, String str, boolean isCaseSensitive)
Parameter | Description |
---|---|
arr | a parameter |
str | a parameter |
isCaseSensitive | a parameter |
public static boolean arrayContainsString(String[] arr, String str, boolean isCaseSensitive)
//package com.java2s; //License from project: Open Source License public class Main { /**//w ww .j a v a 2 s . c o m * check if a string is included in the array * index numbers follow the convention of substring * @param arr * @param str * @param isCaseSensitive * @return true if str isn't null and is found in arr, false otherwise */ public static boolean arrayContainsString(String[] arr, String str, boolean isCaseSensitive) { boolean found = false; if (arr != null) for (int i = 0; i < arr.length && !found; i++) { if (arr[i].equals(str) || (!isCaseSensitive && arr[i].equalsIgnoreCase(str))) found = true; } return found; } }