Example usage for java.lang String toLowerCase

List of usage examples for java.lang String toLowerCase

Introduction

In this page you can find the example usage for java.lang String toLowerCase.

Prototype

public String toLowerCase() 

Source Link

Document

Converts all of the characters in this String to lower case using the rules of the default locale.

Usage

From source file:Main.java

public static boolean isImage(String type) {
    if (TextUtils.isEmpty(type)) {
        return false;
    }/*  w w  w.j ava 2s .c  o m*/
    type = type.toLowerCase();
    if ((type.equals("jpg") || type.equals("gif") || type.equals("png") || type.equals("jpeg")
            || type.equals("bmp") || type.equals("wbmp") || type.equals("ico") || type.equals("jpe"))) {
        return true;
    }
    return false;
}

From source file:Main.java

public static String aggregatedTextContains(final String text) {
    return format("contains(%s, '%s')", translateTextForPath("normalize-space(string(.))"), text.toLowerCase());
}

From source file:com.xpeppers.phonedirectory.services.PhoneDirectoryServiceImpl.java

private static String anywhere(String value) {
    return "%" + value.toLowerCase() + "%";
}

From source file:com.thoughtworks.go.server.domain.user.FilterValidator.java

static void validateNameIsUnique(Map<String, DashboardFilter> current, String name) {
    if (current.containsKey(name.toLowerCase()))
        throw new FilterValidationException("Duplicate filter name: " + name);
}

From source file:Main.java

public static byte[] hexStringToByte(String hex) {
    int len = (hex.length() / 2);
    byte[] result = new byte[len];
    hex = hex.toLowerCase();
    int k = 0;//from  ww  w. jav  a  2s .  c o  m
    for (int i = 0; i < result.length; i++) {
        byte high = (byte) (Character.digit(hex.charAt(k), 16) & 0xff);
        byte low = (byte) (Character.digit(hex.charAt(k + 1), 16) & 0xff);
        result[i] = (byte) (high << 4 | low);
        k += 2;

    }
    return result;
}

From source file:org.paxml.file.FileHelper.java

public static void registerFactory(IFileFactory fact, String... fileExtensions) {
    for (String ext : fileExtensions) {
        factories.put(ext.toLowerCase(), fact);
    }// w  w  w  . j a  v a2  s .c  o m
}

From source file:BooleanUtil.java

public static boolean parseBooleanIgnoreCase(String value) {
    if (value == null) {
        return false;
    }/*from  w  w w .  j ava  2  s . co m*/
    return TRUE.equals(value.toLowerCase());
}

From source file:com.digitalpebble.stormcrawler.aws.bolt.CloudSearchUtils.java

/**
 * Remove the non-cloudSearch-legal characters. Note that this might convert
 * two fields to the same name.//from w  ww.j a va  2s  .c o m
 * 
 * @see <a
 *      href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/configuring-index-fields.html">
 *      configuring-index-fields.html</a>
 * @param name
 * @return
 */
public static String cleanFieldName(String name) {
    String lowercase = name.toLowerCase();
    lowercase = lowercase.replaceAll("[^a-z_0-9]", "_");
    if (lowercase.length() < 3 || lowercase.length() > 64)
        throw new RuntimeException("Field name must be between 3 and 64 chars : " + lowercase);
    if (lowercase.equals("score"))
        throw new RuntimeException("Field name must be score");
    return lowercase;
}

From source file:com.siberhus.web.ckeditor.utils.FileUtils.java

public static boolean isAllowed(String ext, String type) {
    String resourceType = type.toLowerCase();
    if ("file".equals(resourceType)) {
        resourceType = "link";
    }//from w w w  .ja  va 2 s  .c  o m
    String fileExt = ext.toLowerCase();
    CkeditorConfig.Upload config = CkeditorConfigurationHolder.config().upload();
    List<String> allowedList = null;// config."${resourceType}".allowed
    List<String> deniedList = null;// config."${resourceType}".denied
    if ("link".equals(resourceType)) {
        allowedList = config.link().allowed();
        deniedList = config.link().denied();
    } else if ("image".equals(resourceType)) {
        allowedList = config.image().allowed();
        deniedList = config.image().denied();
    } else if ("flash".equals(resourceType)) {
        allowedList = config.flash().allowed();
        deniedList = config.flash().denied();
    } else {
        throw new IllegalArgumentException("Unkown resourceType: " + resourceType);
    }
    return ((allowedList.contains(fileExt) || allowedList.isEmpty()) && !(deniedList.contains(fileExt)));
}

From source file:de.bund.bfr.fskml.ScriptFactory.java

/**
 * //  ww w  . j a  v  a 2  s .c o m
 * @param file A file containing script code (e.g.: R code)
 * @return instance of Script
 * @throws IOException
 */
public static Script createScript(final File file) throws IOException {
    Script script = null;

    String language = FilenameUtils.getExtension(file.getPath());
    if (language.toLowerCase().startsWith("r")) {
        script = new RScript(file);
    }
    if (language.toLowerCase().startsWith("py")) {
        script = new PythonScript(file);
    }

    return script;
}