List of usage examples for java.lang String toLowerCase
public String toLowerCase()
From source file:edu.uci.ics.crawler4j.util.Util.java
public static boolean hasXMLContent(String contentType) { if (contentType != null) { String typeStr = contentType.toLowerCase(); if (typeStr.contains("text/xml") || typeStr.contains("application/xml")) { return true; }//from w ww . jav a 2 s . c o m } return false; }
From source file:edu.uci.ics.crawler4j.util.Util.java
public static boolean hasPlainTextContent(String contentType) { if (contentType != null) { String typeStr = contentType.toLowerCase(); if (typeStr.contains("text/plain")) { return true; }/* w w w . ja va 2 s.com*/ } return false; }
From source file:Main.java
public static Map toMap(Object javaBean) { Map result = new HashMap(); Method[] methods = javaBean.getClass().getDeclaredMethods(); for (Method method : methods) { try {//from ww w. j av a2 s.co m if (method.getName().startsWith("get")) { String field = method.getName(); field = field.substring(field.indexOf("get") + 3); field = field.toLowerCase().charAt(0) + field.substring(1); Object value = method.invoke(javaBean, (Object[]) null); result.put(field, null == value ? "" : value.toString()); } } catch (Exception e) { e.printStackTrace(); } } return result; }
From source file:com.siberhus.web.ckeditor.utils.MimeUtils.java
public static String getMimeTypeByExt(String fileExt) { String result = "text/plain"; if (fileExt != null) { String mimeType = MIME_TYPES.get(fileExt.toLowerCase()); if (mimeType != null) { return mimeType; }/*from w w w. jav a 2 s. c om*/ return "application/octet-stream"; } return result; }
From source file:edu.uci.ics.crawler4j.util.Util.java
public static boolean hasBinaryContent(String contentType) { if (contentType != null) { String typeStr = contentType.toLowerCase(); if (typeStr.contains("image") || typeStr.contains("audio") || typeStr.contains("video") || typeStr.contains("application")) { return true; }/* ww w.j a v a 2s . c om*/ } return false; }
From source file:fr.treeptik.cloudunit.utils.CheckUtils.java
/** * Verify the input for the jvm options/*from www . j av a 2 s .c o m*/ * * @param jvmOpts * @param jvmMemory * @param jvmRelease * @throws CheckException */ public static void checkJavaOpts(String jvmOpts, String jvmMemory, String jvmRelease) throws CheckException { if (jvmOpts.toLowerCase().contains("xms") || jvmOpts.toLowerCase().contains("xmx")) { throw new CheckException("You are not allowed to change memory with java opts"); } if (!listJvmMemoriesAllowed.contains(jvmMemory)) { throw new CheckException("You are not allowed to set this jvm memory size : [" + jvmMemory + "]"); } if (!listJvmReleaseAllowed.contains(jvmRelease)) { throw new CheckException("You are not allowed to set this jvm release : [" + jvmRelease + "]"); } }
From source file:com.hangum.tadpole.db.bander.cubrid.CubridExecutePlanUtils.java
/** * cubrid execute plan/*w ww. jav a 2 s .co m*/ * * @param userDB * @param sql * @return * @throws Exception */ public static String plan(UserDBDAO userDB, String sql) throws Exception { if (!sql.toLowerCase().startsWith("select")) { logger.error("[cubrid execute plan ]" + sql); throw new Exception("This statment not select. please check."); } Connection conn = null; ResultSet rs = null; PreparedStatement pstmt = null; try { // Class.forName("cubrid.jdbc.driver.CUBRIDDriver"); // conn = DriverManager.getConnection(userDB.getUrl(), userDB.getUsers(), userDB.getPasswd()); // conn.setAutoCommit(false); // auto commit? false . conn = TadpoleSQLManager.getInstance(userDB).getDataSource().getConnection(); conn.setAutoCommit(false); // auto commit? false . sql = StringUtils.trim(sql).substring(6); if (logger.isDebugEnabled()) logger.debug("[qubrid modifying query]" + sql); sql = "select " + RECOMPILE + sql; pstmt = conn.prepareStatement(sql); ((CUBRIDStatement) pstmt).setQueryInfo(true); rs = pstmt.executeQuery(); String plan = ((CUBRIDStatement) pstmt).getQueryplan(); // ? . // conn.commit(); if (logger.isDebugEnabled()) logger.debug("cubrid plan text : " + plan); return plan; } finally { if (rs != null) rs.close(); if (pstmt != null) pstmt.close(); if (conn != null) conn.close(); } }
From source file:Main.java
/** * Converts a string to title casing.//from w ww . jav a 2 s. co m * @param str * The string to convert. * @return * The converted string. */ public static String toTitleCase(String str) { if (str == null) { return null; } // skip if already contains mixed case if (!str.equals(str.toLowerCase()) && !str.equals(str.toUpperCase())) { return str; } boolean isSeparator = true; StringBuilder builder = new StringBuilder(str); final int len = builder.length(); for (int i = 0; i < len; ++i) { char c = builder.charAt(i); if (isSeparator) { if (Character.isLetterOrDigit(c)) { // Convert to title case and switch out of whitespace mode. builder.setCharAt(i, Character.toTitleCase(c)); isSeparator = false; } } else if (!Character.isLetterOrDigit(c)) { isSeparator = true; } else { builder.setCharAt(i, Character.toLowerCase(c)); } } return builder.toString(); }
From source file:com.handany.base.generator.Generator.java
private static String delDash(String str) { String lowerCaseStr = str.toLowerCase(); String[] noDashArray = lowerCaseStr.split("_"); StringBuilder sb = new StringBuilder(noDashArray[0]); for (int i = 1; i < noDashArray.length; i++) { sb.append(StringUtils.capitalize(noDashArray[i])); }//from w ww. j a va 2 s. c om return sb.toString(); }
From source file:Main.java
public static String getFilterSuffix(Map<String, List<String>> filters) { if (filters == null) return ""; String filterstr = ""; if (filters.containsKey("type") == true) { filterstr += "("; for (String filter : filters.get("type")) { if (filter.toLowerCase().equals("html")) { filterstr += "Content-Type:*html* OR "; } else if (filter.toLowerCase().equals("image")) { filterstr += "Content-Type:image* OR "; } else if (filter.toLowerCase().equals("video")) { filterstr += "Content-Type:video* OR "; } else if (filter.toLowerCase().equals("audio")) { filterstr += "Content-Type:audio* OR "; } else if (filter.toLowerCase().equals("text")) { filterstr += "Content-Type:text* OR "; }/* ww w . jav a 2s .c o m*/ } // remove the last " OR " and close the search string for this part filterstr = filterstr.substring(0, filterstr.length() - 4); filterstr += ") AND "; } // TODO if "ProfileName" includes special chars like (,", ... we will have a problem with the search? if (filters.containsKey("source") == true) { filterstr += "("; // something like this will come "org.backmeup.source (ProfileName)" for (String filter : filters.get("source")) { // get out the source plugin, result will be "org.backmeup.source" String source = filter.substring(0, filter.indexOf(" ")); // get out the profile "(Profilename)" String profile = filter.substring(filter.indexOf(" ") + 1, filter.length()); // remove the brackets at begin and end, result will be "ProfileName" profile = profile.substring(1, profile.length() - 1); filterstr += "(" + FIELD_BACKUP_SOURCE_PLUGIN_NAME + ":" + source + " AND " + FIELD_BACKUP_SOURCE_IDENTIFICATION + ":" + profile + ") OR "; } // remove the last " OR " and close the search string for this part filterstr = filterstr.substring(0, filterstr.length() - 4); filterstr += ") AND "; } // TODO if job contains special chars ... if (filters.containsKey("job") == true) { filterstr += "("; // something like this will come "JobName (Timestamp)" (java timestamp -> 13 chars) for (String filter : filters.get("job")) { // get out the timestamp (also remove the "()"). String timestamp = filter.substring(filter.length() - 14, filter.length() - 1); // get out the job name String jobname = filter.substring(0, filter.length() - 16); filterstr += "(" + FIELD_BACKUP_AT + ":" + timestamp + " AND " + FIELD_JOB_NAME + ":" + jobname + ") OR "; } // remove the last " OR " and close the search string for this part filterstr = filterstr.substring(0, filterstr.length() - 4); filterstr += ") AND "; } return filterstr; }