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:com.hpcloud.mon.app.validation.Validation.java

/**
 * @throws WebApplicationException if the {@code statistics} empty or invalid.
 *///from   w w  w.j  a  v a2 s .  co  m
public static void validateAlarmState(String state) {
    String stateLower = state.toLowerCase();
    if (!VALID_ALARM_STATE.contains(stateLower)) {
        throw Exceptions.unprocessableEntity("%s is not a valid state", state);
    }
}

From source file:com.censoredsoftware.library.util.StringUtil2.java

/**
 * Returns true if the <code>string</code> starts with a vowel.
 *
 * @param string the string to check.//from w  w w. j  a  v a 2s .c  o m
 */
public static boolean beginsWithVowel(String string) {
    String[] vowels = { "a", "e", "i", "o", "u" };
    return StringUtils.startsWithAny(string.toLowerCase(), vowels);
}

From source file:ImageIOTest.java

/**
 * Gets a set of "preferred" format names of all image writers. The preferred format name is the
 * first format name that a writer specifies.
 * @return the format name set/*ww w .  j  a  va  2 s  .c o  m*/
 */
public static Set<String> getWriterFormats() {
    TreeSet<String> writerFormats = new TreeSet<String>();
    TreeSet<String> formatNames = new TreeSet<String>(Arrays.asList(ImageIO.getWriterFormatNames()));
    while (formatNames.size() > 0) {
        String name = formatNames.iterator().next();
        Iterator<ImageWriter> iter = ImageIO.getImageWritersByFormatName(name);
        ImageWriter writer = iter.next();
        String[] names = writer.getOriginatingProvider().getFormatNames();
        String format = names[0];
        if (format.equals(format.toLowerCase()))
            format = format.toUpperCase();
        writerFormats.add(format);
        formatNames.removeAll(Arrays.asList(names));
    }
    return writerFormats;
}

From source file:be.roots.taconic.pricingguide.domain.Currency.java

public static Currency getEnum(String value) {

    if (!StringUtils.isEmpty(value)) {
        for (Currency currency : Currency.values()) {
            if (value.toLowerCase().endsWith(currency.getDescription().toLowerCase())) {
                return currency;
            }/*from w  w w.  jav a  2s  .c  om*/
        }
    }
    return null;
}

From source file:investor.network.NetworkManager.java

public static Index[] showMore(String what, DataRange range) throws IOException, JSONException {
    return downloadFromServer(buildUrl(what.toLowerCase(), range));
}

From source file:com.bbva.kltt.apirest.core.web.Utilities.java

/**
 * Read the file content//  w  w  w .j  a va2s. c om
 * @param filePath with the file path
 * @return the file content as byte array
 * @throws APIRestGeneratorException with an occurred exception
 */
public static byte[] readFileContent(final String filePath) throws APIRestGeneratorException {
    Path path = null;

    if (filePath.toLowerCase().startsWith(ConstantsInput.SO_PATH_STRING_PREFIX)) {
        path = Paths.get(URI.create(filePath));
    } else {
        path = Paths.get(filePath, new String[0]);
    }

    byte[] fileContent = null;

    if (Files.exists(path, new LinkOption[0])) {
        try {
            fileContent = FileUtils.readFileToByteArray(path.toFile());
        } catch (IOException ioException) {
            final String errorString = "IOException when reading the file '" + filePath + "': " + ioException;

            Utilities.LOGGER.error(errorString, ioException);
            throw new APIRestGeneratorException(errorString, ioException);
        }
    }

    return fileContent;
}

From source file:com.kylinolap.query.test.H2Database.java

private static String getH2DataType(String javaDataType) {
    String hiveDataType = javaToH2DataTypeMapping.get(javaDataType.toLowerCase());
    if (hiveDataType == null) {
        hiveDataType = javaDataType;/*from  www.j a v a2  s. c  o  m*/
    }
    return hiveDataType.toLowerCase();
}

From source file:it.polimi.modaclouds.monitoring.monitoring_manager.Util.java

public static boolean softEquals(String name1, String name2) {
    return name1.toLowerCase().equals(name2.toLowerCase());
}

From source file:liveplugin.toolwindow.addplugin.git.jetbrains.plugins.github.util.GithubSslSupport.java

private static boolean isTrusted(@NotNull String host) {
    return GithubSettings.getInstance().getTrustedHosts().contains(host.toLowerCase());
}

From source file:Main.java

/**
 * Convert a string based locale into a Locale Object
 * <br>/*from   ww  w  . j  a v a  2  s  .  c  o  m*/
 * <br>Strings are formatted:
 * <br>
 * <br>language_contry_variant
 *
 **/
public static Locale getLocaleFromString(String localeString) {
    if (localeString == null) {
        return null;
    }
    if (localeString.toLowerCase().equals("default")) {
        return Locale.getDefault();
    }
    int languageIndex = localeString.indexOf('_');
    if (languageIndex == -1) {
        return null;
    }
    int countryIndex = localeString.indexOf('_', languageIndex + 1);
    String country = null;
    if (countryIndex == -1) {
        if (localeString.length() > languageIndex) {
            country = localeString.substring(languageIndex + 1, localeString.length());
        } else {
            return null;
        }
    }
    int variantIndex = -1;
    if (countryIndex != -1) {
        countryIndex = localeString.indexOf('_', countryIndex + 1);
    }
    String language = localeString.substring(0, languageIndex);
    String variant = null;
    if (variantIndex != -1) {
        variant = localeString.substring(variantIndex + 1, localeString.length());
    }
    if (variant != null) {
        return new Locale(language, country, variant);
    } else {
        return new Locale(language, country);
    }
}