List of usage examples for java.lang String equalsIgnoreCase
public boolean equalsIgnoreCase(String anotherString)
From source file:Main.java
public static boolean isBooleanValue(String value) { boolean result = false; if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("false")) { result = true;/* w w w . ja v a2 s . c o m*/ } return result; }
From source file:Main.java
/** * Checks if specified string is present in the string array collection. * /*from w w w. ja v a 2s . c o m*/ * @param array * @param element * @return boolean value */ public static boolean contains(String[] array, String element) { for (String arrayElement : array) { if (arrayElement.equalsIgnoreCase(element)) return true; } return false; }
From source file:Main.java
public static String GetFilename(String uri) { if (uri.equalsIgnoreCase("/")) { return "/"; }//from w w w . ja v a2 s . co m if (uri.endsWith("/")) { uri = uri.substring(0, uri.length() - 1); } if (uri.indexOf('/') < 0) { return uri; } SimpleStringSplitter sss = new SimpleStringSplitter('/'); sss.setString(uri); String tmp = ""; String ret = ""; while (sss.hasNext()) { tmp = sss.next(); if (tmp.trim().length() > 0) { ret = tmp.trim(); } } return ret; }
From source file:Main.java
public static boolean isNetworkAvailable(Context ctx) { ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo[] netInfo = cm.getAllNetworkInfo(); for (NetworkInfo ni : netInfo) { String name = ni.getTypeName(); if (name.equalsIgnoreCase("ETH")) if (ni.isConnected()) return true; if (name.equalsIgnoreCase("WIFI")) if (ni.isConnected()) return true; if (name.equalsIgnoreCase("MOBILE")) if (ni.isConnected()) return true; }// www .ja v a 2 s. c o m return false; }
From source file:Main.java
/** * Indetifca em qual arquitetura a JRE esta executando * @return//from w w w.j a va 2 s . co m */ public static int getArchitecture() { String architecture = System.getProperty("sun.arch.data.model"); if (architecture.equalsIgnoreCase("64")) { return ARC_JRE_64; } else { return ARC_JRE_32; } }
From source file:Main.java
private static boolean isImage(String ext) { for (String s : IMAGE_EXTENSIONS) { if (s.equalsIgnoreCase(ext)) return true; }//from ww w.j a v a 2s . co m return false; }
From source file:Main.java
private static boolean isAudio(String ext) { for (String s : AUDIO_EXTENSIONS) { if (s.equalsIgnoreCase(ext)) return true; }/*w ww. j a v a 2 s . com*/ return false; }
From source file:Main.java
/** * Remove the given element from the array. * * The check is done using String.equalsIgnoreCase() so it's case in-sensitive. * * @param array the array// ww w. j a va2s . co m * @param remove the element to remove * @return a copy of the original array without the element. */ public static String[] removeElement(String[] array, String remove) { if (array == null) return array; if (remove == null) return array; List<String> elements = new ArrayList<>(array.length); for (String s : array) { if (s.equalsIgnoreCase(remove)) continue; elements.add(s); } return elements.toArray(new String[0]); }
From source file:Main.java
public static String getTheName(String target) { if (target.length() < 3) //prevent crashing if the name is like 1 and I just want to edit it. {/*from w ww . j a v a 2 s. com*/ return target; } String possibleRemoval = target.substring(target.length() - 2); if (possibleRemoval.equalsIgnoreCase("-d") || possibleRemoval.equalsIgnoreCase("-s") || possibleRemoval.equalsIgnoreCase("-u") || possibleRemoval.equalsIgnoreCase("-a") || possibleRemoval.equalsIgnoreCase("-r") || possibleRemoval.equalsIgnoreCase("-n")) { return target.substring(0, target.length() - 3); } return target; }
From source file:Main.java
/** * * @param bool/* w w w . ja va2 s . c o m*/ * @return */ public static boolean convertStringToBoolean(String bool) { bool = bool.toLowerCase().toString().trim(); if (bool.equalsIgnoreCase("t") || bool.equalsIgnoreCase("true") || bool.equalsIgnoreCase("1") || bool.equalsIgnoreCase("yes") || bool.equalsIgnoreCase("y") || bool.equalsIgnoreCase("ok")) { return true; } return false; }