List of usage examples for java.lang String equalsIgnoreCase
public boolean equalsIgnoreCase(String anotherString)
From source file:Main.java
public static boolean selectBooleanElement(Element parent, String elementName) { String result = selectStringElement(parent, elementName, "0"); if (result.equalsIgnoreCase("1") || result.equalsIgnoreCase("true")) { return true; }/* w w w . j a v a 2 s . c o m*/ return false; }
From source file:Main.java
/** * judge whether is a pdz file.//from w ww. java 2s . co m * * @param path the file path * @return true if it is a image file, otherwise false */ public static boolean isTemplateFile(String path) { String extention = path.substring(path.lastIndexOf(".", path.length()) + 1, path.length()); if (extention.equalsIgnoreCase("pdz") || extention.equalsIgnoreCase("blf")) { return true; } return false; }
From source file:Main.java
private static String renderTelephone(String bodyHtml) { StringBuffer bodyStringBuffer = new StringBuffer(); Matcher matcherTelContent = patternTagTitle.matcher(bodyHtml); while (matcherTelContent.find()) { String processContent = matcherTelContent.group(1); String htmlContent = matcherTelContent.group(2); if (htmlContent.equalsIgnoreCase("</script>") || htmlContent.equalsIgnoreCase("</a>")) { matcherTelContent.appendReplacement(bodyStringBuffer, processContent + htmlContent); } else {//w ww. j a v a 2 s . co m String telContentHasProcessed = makeTelNoHerf(processContent); matcherTelContent.appendReplacement(bodyStringBuffer, telContentHasProcessed + htmlContent); } } matcherTelContent.appendTail(bodyStringBuffer); return bodyStringBuffer.toString(); }
From source file:Main.java
public static String stringNull(String s) { if (s != null) { s = s.trim();/*from w ww . ja va2 s . co m*/ if (s.equals("") || s.equalsIgnoreCase("null")) s = ""; } return s; }
From source file:Main.java
public static Node getParent(String tagName, Node node) { Node parent = node.getParentNode(); while (parent != null && !tagName.equalsIgnoreCase(parent.getNodeName())) { parent = parent.getParentNode(); }/*from w w w.j a va2s . com*/ return parent; }
From source file:ImageUtil.java
/** * check if image supported// ww w . j a v a2s . c om * @param extName extension name of image file * @return true supported, else false */ public static boolean isSupportedImage(String extName) { boolean isSupported = false; for (String format : ImageIO.getReaderFormatNames()) { if (format.equalsIgnoreCase(extName)) { isSupported = true; break; } } return isSupported; }
From source file:Main.java
public static final String convertStringCharset(String originalString, String sourceCharset, String targetCharset) {//from w w w . j av a 2s . c o m if (sourceCharset.equalsIgnoreCase(targetCharset)) { return originalString; } final Charset charset = Charset.forName(sourceCharset); final ByteBuffer byteBuffer = charset.encode(originalString); // byteBuffer.array() "may" return byte array which is larger than // byteBuffer.remaining(). Here, we keep on the safe side. final byte[] bytes = new byte[byteBuffer.remaining()]; byteBuffer.get(bytes); try { return new String(bytes, targetCharset); } catch (UnsupportedEncodingException e) { Log.e(LOG_TAG, "Failed to encode: charset=" + targetCharset); return null; } }
From source file:Main.java
/** * Get a boolean attribute from the supplied element. * @param element The element.// w w w. j a v a 2 s. c o m * @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 attribVal = element.getAttribute(attribName); return (attribVal != null && attribVal.equalsIgnoreCase("true")); }
From source file:cn.guoyukun.spring.web.utils.ServletUtils.java
/** * url?method firstPrefix+lastPrefixes//from w ww. j a v a 2 s .com * ?url/sample/create ?firstPrefix:/sample lastPrefixed /create * * @param request * @param method * @param firstPrefix * @param lastPrefixes * @return */ public static boolean startWith(HttpServletRequest request, RequestMethod method, String firstPrefix, String... lastPrefixes) { String requestMethod = request.getMethod(); if (!requestMethod.equalsIgnoreCase(method.name())) { return false; } String url = request.getServletPath(); if (!url.startsWith(firstPrefix)) { return false; } if (lastPrefixes.length == 0) { return true; } url = url.substring(firstPrefix.length()); for (String lastPrefix : lastPrefixes) { if (url.startsWith(lastPrefix)) { return true; } } return false; }
From source file:com.beyondjservlet.gateway.servlet.support.ProxySupport.java
/** * Checks if the passed-in header is a hop-by-hop header as defined by * <a href="http://tools.ietf.org/html/rfc2616#section-13.5.1">RFC-2616 Section 13.5.1</a>. * * @param header the header name to check. * @return {@code true} if the header is a hop-by-hop header, false otherwise. */// w w w. ja va2 s . c o m public static boolean isHopByHopHeader(final String header) { return header.equalsIgnoreCase("Connection") || header.equalsIgnoreCase("Keep-Alive") || header.equalsIgnoreCase("Proxy-Authentication") || header.equalsIgnoreCase("Proxy-Authorization") || header.equalsIgnoreCase("TE") || header.equalsIgnoreCase("Trailers") || header.equalsIgnoreCase("Transfer-Encoding") || header.equalsIgnoreCase("Upgrade"); }