List of usage examples for java.lang String toLowerCase
public String toLowerCase()
From source file:Main.java
static public String getTagContentFromPosition_old(String inputTXT, String tag, int nPosition) { String content = ""; String tagEnd = "</" + tag.toLowerCase() + ">"; int idx_tagEnd = inputTXT.indexOf(tagEnd, nPosition); // System.out.println("nPosition:"+nPosition); // System.out.println("idx_tagEnd:"+idx_tagEnd); if (idx_tagEnd == -1) { tagEnd = "</" + tag.toUpperCase() + ">"; idx_tagEnd = inputTXT.indexOf(tagEnd, nPosition); }/* w w w .ja v a2 s . c o m*/ if (idx_tagEnd > nPosition) { content = inputTXT.substring(nPosition, idx_tagEnd); } // System.out.println("Content is:" + content); return content; }
From source file:Main.java
/** * Determine if the current s is a scientific notation or not * The format of scientific notation is as follows: * 1e19, 3.1e3, 1e-2, .3e4, 3E4E5E/*from w w w . j a v a 2s . c o m*/ * @param s * @return */ public static boolean isScientificNotation(String s) { if (s == null || s.length() == 0) return false; String[] arr = s.toLowerCase().split("e"); if (arr.length == 0 || !(isDecimal(arr[0]) || isInteger(arr[0]))) return false; for (int i = 1; i < arr.length; i++) { if (!isInteger(arr[i])) return false; } return true; }
From source file:au.org.ala.biocache.dto.OccurrenceSource.java
public static OccurrenceSource getForDisplayName(String name) { if (StringUtils.isBlank(name)) return null; return displayNameLookup.get(name.toLowerCase()); }
From source file:com.amazonaws.codepipeline.jenkinsplugin.TestUtils.java
public static void assertContainsIgnoreCase(final String strToMatch, final String strToCheck) { final String strToMatchLower = strToMatch.toLowerCase(); final String strToCheckLower = strToCheck.toLowerCase(); assertTrue(strToCheckLower.contains(strToMatchLower)); }
From source file:com.amazonaws.codepipeline.jenkinsplugin.TestUtils.java
public static void assertEqualsIgnoreCase(final String strToMatch, final String strToCheck) { final String strToMatchLower = strToMatch.toLowerCase(); final String strToCheckLower = strToCheck.toLowerCase(); assertEquals(strToMatchLower, strToCheckLower); }
From source file:de.micromata.genome.gwiki.jetty.CmdLineInput.java
public static boolean ask(String message, boolean defaultYes) { System.out.println(message);/* ww w . j a v a 2 s . c om*/ do { if (defaultYes == true) { System.out.print("([Yes]/No): "); } else { System.out.print("(Yes/[No]): "); } String inp = StringUtils.trim(readLine()); inp = inp.toLowerCase(); if (StringUtils.isEmpty(inp) == true) { return defaultYes; } if (inp.equalsIgnoreCase("y") == true || inp.equalsIgnoreCase("yes") == true) { return true; } if (inp.equalsIgnoreCase("n") == true || inp.equalsIgnoreCase("no") == true) { return false; } } while (true); }
From source file:Main.java
/** * Check whether this string starts with a number that needs "an" (e.g. * "an 18% increase")/*w w w . j av a2 s . c om*/ * * @param string * the string * @return <code>true</code> if this string starts with 11, 18, or 8, * excluding strings that start with 180 or 110 */ public static boolean requiresAn(String string) { boolean req = false; String lowercaseInput = string.toLowerCase(); if (lowercaseInput.matches(AN_AGREEMENT) && !isAnException(lowercaseInput)) { req = true; } else { String numPref = getNumericPrefix(lowercaseInput); if (numPref != null && numPref.length() > 0 && numPref.matches("^(8|11|18).*$")) { Integer num = Integer.parseInt(numPref); req = checkNum(num); } } return req; }
From source file:com.buddycloud.mediaserver.business.util.ImageUtils.java
public static boolean isImage(String extension) { return Arrays.binarySearch(FORMATS, extension.toLowerCase()) >= 0; }
From source file:io.wcm.sling.commons.util.Escape.java
/** * Creates a valid node name. Replaces all chars not in a-z, A-Z and 0-9 or '_' with '-' and converts all to lowercase. * @param value String to be labelized./* w ww . j av a 2 s . co m*/ * @return The labelized string. */ public static String validName(String value) { // convert to lowercase String text = value.toLowerCase(); // replace some special chars first text = StringUtils.replace(text, "", "ae"); text = StringUtils.replace(text, "", "oe"); text = StringUtils.replace(text, "", "ue"); text = StringUtils.replace(text, "", "ss"); // replace all invalid chars StringBuilder sb = new StringBuilder(text); for (int i = 0; i < sb.length(); i++) { char ch = sb.charAt(i); if (!((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || (ch == '_'))) { ch = '-'; sb.setCharAt(i, ch); } } return sb.toString(); }
From source file:no.digipost.api.useragreements.client.filters.request.RequestMessageSignatureUtil.java
private static String getCanonicalHeaderRepresentation(final RequestToSign request) { SortedMap<String, String> headers = request.getHeaders(); StringBuilder headersString = new StringBuilder(); for (Entry<String, String> entry : headers.entrySet()) { String key = entry.getKey(); if (isHeaderForSignature(key)) { headersString.append(key.toLowerCase() + ": " + entry.getValue() + "\n"); }/*from w w w . j av a 2s .c o m*/ } return headersString.toString(); }