List of usage examples for java.lang String equalsIgnoreCase
public boolean equalsIgnoreCase(String anotherString)
From source file:Main.java
public static String getLauncherClassName(Context context) { PackageManager pm = context.getPackageManager(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); List<ResolveInfo> resolveInfos = pm.queryIntentActivities(intent, 0); for (ResolveInfo resolveInfo : resolveInfos) { String pkgName = resolveInfo.activityInfo.applicationInfo.packageName; if (pkgName.equalsIgnoreCase(context.getPackageName())) { String className = resolveInfo.activityInfo.name; return className; }// ww w .jav a 2 s . c o m } return null; }
From source file:Main.java
public static void getFileList(final List<File> fileList, final File root, final File[] ignoreList) { final File[] list = root.listFiles(); if (list == null) { return;//from w ww . ja va 2 s . c o m } for (final File f : list) { if (f.isDirectory() && !isIgnored(ignoreList, f)) { getFileList(fileList, f, ignoreList); } else { String filename = getFileExt(f.getName()); if (filename.equalsIgnoreCase("jpg") || filename.equalsIgnoreCase("png") || filename.equalsIgnoreCase("mp4")) { fileList.add(f); } } } }
From source file:com.goncalomb.bukkit.mylib.namemaps.EntityTypeMap.java
public static EntityType getByName(String name) { if (name.equalsIgnoreCase("ThrownPotion")) { return EntityType.SPLASH_POTION; } else if (name.equalsIgnoreCase("ThrownEgg")) { return EntityType.EGG; } else if (name.equalsIgnoreCase("MinecartSpawner")) { return EntityType.MINECART_MOB_SPAWNER; } else if (name.equalsIgnoreCase("AreaEffectCloud")) { return EntityType.AREA_EFFECT_CLOUD; } else {//from ww w .j a v a 2 s .c o m return EntityType.fromName(name); } }
From source file:com.google.gdt.eclipse.designer.util.ui.HtmlSelectionDialog.java
private static boolean checkExtension(String extension) { for (String ext : EXTENSIONS) { if (ext.equalsIgnoreCase(extension)) { return true; }/*from w w w . ja v a 2 s . c o m*/ } return false; }
From source file:Main.java
static String downloadHtml(String urlString) { StringBuffer buffer = new StringBuffer(); try {// www .j av a 2 s . c o m URL url = new URL(urlString); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); HttpURLConnection.setFollowRedirects(true); conn.setRequestProperty("Accept-Encoding", "gzip, deflate"); String encoding = conn.getContentEncoding(); InputStream inStr = null; if (encoding != null && encoding.equalsIgnoreCase("gzip")) { inStr = new GZIPInputStream(conn.getInputStream()); } else if (encoding != null && encoding.equalsIgnoreCase("deflate")) { inStr = new InflaterInputStream(conn.getInputStream(), new Inflater(true)); } else { inStr = conn.getInputStream(); } int ptr = 0; InputStreamReader inStrReader = new InputStreamReader(inStr, Charset.forName("GB2312")); while ((ptr = inStrReader.read()) != -1) { buffer.append((char) ptr); } inStrReader.close(); conn.disconnect(); inStr.close(); } catch (Exception e) { e.printStackTrace(); } return buffer.toString(); }
From source file:Main.java
/** * Get a boolean attribute from the supplied element. * @param element The element.// w w w . j a va2 s .com * @param namespaceURI Namespace URI of the required attribute. * @param attribName The attribute name. * @return True if the attribute value is "true" (case insensitive), otherwise false. */ public static boolean getBooleanAttrib(Element element, String attribName, String namespaceURI) { String attribVal = element.getAttributeNS(namespaceURI, attribName); return (attribVal != null && attribVal.equalsIgnoreCase("true")); }
From source file:Main.java
/** * Check whether the given nodes containes an attribute with the given name and value.<br> * The name and value of the attribute MUST be the same of the node ones in order to have true as * a result.<br> The check is case insensitive.<br> * /* w w w. j a va2 s .c o m*/ * @param node node to be analyzed * @param attrName the attribute name to be matched * @param attrValue the attribute value to be matched * @return <code>true</code> if node containes the given attributes, <code>false</code> otherwise (even if node is null) */ public static boolean nodeAttributeEquals(Node node, String attrName, String attrValue) { if (node != null && node.getNodeType() == Node.ELEMENT_NODE) { String value = ((Element) node).getAttribute(attrName); return (value != null && value.equalsIgnoreCase(attrValue)); } else { return false; } }
From source file:Main.java
/** * convert longitude from DMS (Degrees, Minutes, Seconds) to DD (Decimal Degrees) * * @param int longDeg - longitude degree value * @param double longMin - longitude minute value * @param double longSec - longitude second value * @param String longDir - longitude direction (west or east) * @return double - double values for given longitude */// w w w. j a v a 2 s . c o m public static double convertLongDMStoDD(int longDeg, int longMin, double longSec, String longDir) { double longitude = longDeg + (longMin / new Double(60)) + (longSec / new Double(3600)); if (longDir.equalsIgnoreCase("w")) longitude = -longitude; return longitude; }
From source file:Main.java
public static String getLauncherClassName(Context context) { PackageManager pm = context.getPackageManager(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); List<ResolveInfo> resolveInfos = pm.queryIntentActivities(intent, 0); for (ResolveInfo resolveInfo : resolveInfos) { String pkgName = resolveInfo.activityInfo.applicationInfo.packageName; if (pkgName.equalsIgnoreCase(context.getPackageName())) { String className = resolveInfo.activityInfo.name; return className; }//from w w w .ja v a 2 s . co m } return null; }
From source file:Main.java
public static boolean stringsEqual(@Nullable String one, @Nullable String another, boolean ignoreCase) { return !(one != null ? (!ignoreCase ? !one.equals(another) : !one.equalsIgnoreCase(another)) : another != null);/*from w ww .j a va 2 s .co m*/ }