List of usage examples for java.lang String equalsIgnoreCase
public boolean equalsIgnoreCase(String anotherString)
From source file:com.textocat.textokit.morph.commons.GramModelBasedTagMapper.java
public static Set<String> parseTag(String tag) { if (StringUtils.isEmpty(tag) || tag.equalsIgnoreCase("null")) { return Sets.newLinkedHashSet(); }/*from ww w . java 2 s. c om*/ return Sets.newLinkedHashSet(targetGramSplitter.split(tag)); }
From source file:Main.java
public static Node getParentById(String id, Node node) { Node parent = node.getParentNode(); while (parent != null) { if (parent instanceof Element && id.equalsIgnoreCase(((Element) parent).getAttribute("id"))) { return parent; } else {/*from w ww. ja va 2s . co m*/ parent = parent.getParentNode(); } } return parent; }
From source file:Main.java
public static int getWinsFromString(String wins) { if (wins == null) return 0; else if (wins.length() == 0) return 0; else if (wins.equalsIgnoreCase("w")) return 1; else if (wins.equalsIgnoreCase("-")) return 0; else if (wins.equalsIgnoreCase("q")) return 1; else/*from w w w . j a v a 2 s . c o m*/ try { return Integer.parseInt(wins); } catch (NumberFormatException e) { return 0; } }
From source file:net.bluehornreader.service.ServiceManager.java
private static boolean isHelp(String[] args) { if (args.length == 0) { return true; }// w w w . j a va2 s. c om for (String s : args) { if (s.equalsIgnoreCase("-h") || s.equalsIgnoreCase("--help") || s.equalsIgnoreCase("-?")) { return true; } } return false; }
From source file:net.sf.ehcache.store.MemoryStoreEvictionPolicy.java
/** * Converts a string representation of the policy into a policy. * * @param policy either LRU, LFU or FIFO * @return one of the static instances// www . ja v a 2s . c om */ public static MemoryStoreEvictionPolicy fromString(String policy) { if (policy != null) { if (policy.equalsIgnoreCase("LRU")) { return LRU; } else if (policy.equalsIgnoreCase("LFU")) { return LFU; } else if (policy.equalsIgnoreCase("FIFO")) { return FIFO; } } if (LOG.isWarnEnabled()) { LOG.warn("The memoryStoreEvictionPolicy of " + policy + " cannot be resolved. The policy will be" + " set to LRU"); } return LRU; }
From source file:Main.java
public static boolean isContainAttachment(Part part) throws MessagingException, IOException { boolean flag = false; if (part.isMimeType("multipart/*")) { MimeMultipart multipart = (MimeMultipart) part.getContent(); int partCount = multipart.getCount(); for (int i = 0; i < partCount; i++) { BodyPart bodyPart = multipart.getBodyPart(i); String disp = bodyPart.getDisposition(); if (disp != null && (disp.equalsIgnoreCase(Part.ATTACHMENT) || disp.equalsIgnoreCase(Part.INLINE))) { flag = true;/* ww w.jav a 2s. c o m*/ } else if (bodyPart.isMimeType("multipart/*")) { flag = isContainAttachment(bodyPart); } else { String contentType = bodyPart.getContentType(); if (contentType.indexOf("application") != -1) { flag = true; } if (contentType.indexOf("name") != -1) { flag = true; } } if (flag) break; } } else if (part.isMimeType("message/rfc822")) { flag = isContainAttachment((Part) part.getContent()); } return flag; }
From source file:Main.java
public static boolean hasChild(Node xml, String name) { NodeList nl = xml.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node n = nl.item(i);// w w w .j a v a2 s. c o m if (name.equalsIgnoreCase(n.getNodeName())) return true; } return false; }
From source file:Main.java
public static String removeCommas(String text) { Pattern p = Pattern.compile("(\\d+),(\\d\\d\\d$|\\d\\d\\d\\D)"); String oldText; do {/*from w ww . j a va 2s . c o m*/ oldText = text; Matcher m = p.matcher(text); text = m.replaceAll("$1$2"); } while (oldText.equalsIgnoreCase(text) == false); return text; }
From source file:Main.java
private static Bitmap getThumbnail(String filePath, int targetW, int targetH) { Bitmap bitmap = null;/* www . j a v a 2 s .c om*/ File file = new File(filePath); String fileName = file.getName(); if (fileName.lastIndexOf(".") < 0) { return bitmap; } String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1); if (fileExtension.equalsIgnoreCase(IMAGE_TYPT_BMP) || fileExtension.equalsIgnoreCase(IMAGE_TYPT_JPG) || fileExtension.equalsIgnoreCase(IMAGE_TYPT_JPEG) || fileExtension.equalsIgnoreCase(IMAGE_TYPT_PNG) || fileExtension.equalsIgnoreCase(IMAGE_TYPT_GIF)) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(filePath, options); int bitmapRealWidth = options.outWidth; int bitmapRealHeight = options.outHeight; options.outWidth = targetW; if (bitmapRealWidth > 0) { options.outHeight = bitmapRealHeight * targetW / bitmapRealWidth; } options.inJustDecodeBounds = false; if (targetW > 0) { options.inSampleSize = bitmapRealWidth / targetW; } options.inPurgeable = true; options.inInputShareable = true; options.inPreferredConfig = Config.ARGB_4444; bitmap = BitmapFactory.decodeFile(filePath, options); } return bitmap; }
From source file:com.anrisoftware.globalpom.threads.api.ThreadingPolicy.java
private static ThreadingPolicy findPolicy(String value) { for (ThreadingPolicy policy : values()) { if (value.equalsIgnoreCase(policy.name())) { return policy; }//from ww w .j av a2 s. c o m } return null; }