List of usage examples for java.lang String toLowerCase
public String toLowerCase(Locale locale)
From source file:Main.java
public static byte[] decodeHex(String str) { str = str.toLowerCase(Locale.US); int len = str.length(); byte[] data = new byte[len / 2]; for (int i = 0; i < len; i += 2) { data[i / 2] = (byte) ((Character.digit(str.charAt(i), 16) << 4) + Character.digit(str.charAt(i + 1), 16)); }/*from w ww. j a v a 2 s. com*/ return data; }
From source file:Main.java
public static boolean isWebSocketEndpoint(String url) { String urlLowerCase = url.toLowerCase(Locale.US); return urlLowerCase.startsWith("ws://") || urlLowerCase.startsWith("wss://"); }
From source file:Main.java
/** * VERY UGLY. THIS NEEDS A REGEXP//w w w.jav a 2 s .c o m * * @param text1 The container text * @param text2 The text we are looking for * @return true if {@param text1} contains {@param text2} */ public static boolean containsIgnoreCase(final String text1, final String text2) { return text1.toLowerCase(Locale.US).contains(text2.toLowerCase(Locale.US)); }
From source file:Main.java
public static boolean compareIgnoreCase(String str1, String str2) { return str1.toLowerCase(Locale.ENGLISH).equals(str2.toLowerCase(Locale.ENGLISH)); }
From source file:Main.java
/** * Converts text to lower case using {@link Locale#US}. * * @param text The text to convert./* w w w. j a v a 2 s . com*/ * @return The lower case text, or null if {@code text} is null. */ public static String toLowerInvariant(String text) { return text == null ? null : text.toLowerCase(Locale.US); }
From source file:Main.java
public static String getCountry(Context context) { Configuration configuration = context.getResources().getConfiguration(); String country = configuration.locale.getCountry(); return country.toLowerCase(Locale.getDefault()); }
From source file:Main.java
public static boolean isMP3File(String in) { return in.toLowerCase(Locale.US).endsWith(".mp3"); }
From source file:Main.java
public static boolean isWMAFile(String in) { return in.toLowerCase(Locale.US).endsWith(".wma"); }
From source file:Main.java
/** * check if the pair is [UTF-16,UTF-16LE] [UTF-32, UTF-32LE],[UTF-16,UTF-16BE] [UTF-32, * UTF-32BE] etc.//from w w w. j a va 2s . com * * @param enc1 encoding style * @param enc2 encoding style * @return true if the encoding styles are compatible, or false otherwise */ private static boolean compatibleEncodings(String enc1, String enc2) { enc1 = enc1.toLowerCase(Locale.getDefault()); enc2 = enc2.toLowerCase(Locale.getDefault()); if (enc1.endsWith("be") || enc1.endsWith("le")) { enc1 = enc1.substring(0, enc1.length() - 2); } if (enc2.endsWith("be") || enc2.endsWith("le")) { enc2 = enc2.substring(0, enc2.length() - 2); } return enc1.equals(enc2); }
From source file:Main.java
/** * Detects common bzip2 suffixes in the given filename. * * @param filename name of a file// ww w . j a va 2 s . c o m * @return <code>true</code> if the filename has a common bzip2 suffix, * <code>false</code> otherwise */ public static boolean isCompressedFilename(String filename) { String lower = filename.toLowerCase(Locale.ENGLISH); int n = lower.length(); // Shortest suffix is three letters (.bz), longest is five (.tbz2) for (int i = 3; i <= 5 && i < n; i++) { if (uncompressSuffix.containsKey(lower.substring(n - i))) { return true; } } return false; }