List of usage examples for java.lang String toLowerCase
public String toLowerCase(Locale locale)
From source file:Main.java
/** * Maps the given name of a bzip2-compressed file to the name that the * file should have after uncompression. Commonly used file type specific * suffixes like ".tbz" or ".tbz2" are automatically detected and * correctly mapped. For example the name "package.tbz2" is mapped to * "package.tar". And any filenames with the generic ".bz2" suffix * (or any other generic bzip2 suffix) is mapped to a name without that * suffix. If no bzip2 suffix is detected, then the filename is returned * unmapped./*from ww w . ja va 2 s .c o m*/ * * @param filename name of a file * @return name of the corresponding uncompressed file */ public static String getUncompressedFilename(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++) { Object suffix = uncompressSuffix.get(lower.substring(n - i)); if (suffix != null) { return filename.substring(0, n - i) + suffix; } } return filename; }
From source file:it.unibo.alchemist.SupportedIncarnations.java
private static String preprocess(final String s) { return s.toLowerCase(Locale.ENGLISH).replace("incarnation", ""); }
From source file:Main.java
public static boolean isMP3File(String in) { boolean retVal = false; in = in.toLowerCase(Locale.US); if (in.endsWith(".mp3")) retVal = true;/*w w w . j a v a 2 s. com*/ return retVal; }
From source file:Main.java
public static boolean isOGGFile(String in) { boolean retVal = false; in = in.toLowerCase(Locale.US); if (in.endsWith(".ogg")) retVal = true;//w ww .j a v a 2 s .c om return retVal; }
From source file:Main.java
public static boolean isM4AFile(String in) { boolean retVal = false; in = in.toLowerCase(Locale.US); if (in.endsWith(".m4a") || in.endsWith(".m4p")) retVal = true;//from www.ja v a 2s.com return retVal; }
From source file:Main.java
public static boolean isRIFFFile(String in) { return in.toLowerCase(Locale.US).endsWith(".avi"); }
From source file:Main.java
public static boolean isWMVFile(String in) { return in.toLowerCase(Locale.US).endsWith(".wmv"); }
From source file:com.trenako.utility.Slug.java
/** * Encodes the provided String as {@code slug}. * * @param input the String to be encoded * @return the slug/*w ww . java2s . co m*/ */ public static String encode(String input) { Assert.notNull(input, "The input string must be not null"); String nowhitespace = WHITESPACE.matcher(input).replaceAll("-"); String normalized = Normalizer.normalize(nowhitespace, Form.NFD); String slug = NONLATIN.matcher(normalized).replaceAll(""); return slug.toLowerCase(Locale.ENGLISH); }
From source file:Main.java
public static boolean getBooleanQueryParameter(Uri uri, String key, boolean defaultValue) { String flag = uri.getQueryParameter(key); if (flag == null) { return defaultValue; }/*from www . ja va 2 s . c o m*/ flag = flag.toLowerCase(Locale.ROOT); return (!"false".equals(flag) && !"0".equals(flag)); }
From source file:Main.java
/** * Get all device accounts having specified domain name. * @param context application context// w ww. jav a 2 s . com * @param domain domain name used for filtering * @return List of account names that contain the specified domain name */ public static List<String> getDeviceAccountsWithDomain(final Context context, final String domain) { final ArrayList<String> retval = new ArrayList<>(); final String atDomain = "@" + domain.toLowerCase(Locale.ROOT); for (final Account account : getAccounts(context)) { if (account.name.toLowerCase(Locale.ROOT).endsWith(atDomain)) { retval.add(account.name); } } return retval; }