Example usage for java.lang String equalsIgnoreCase

List of usage examples for java.lang String equalsIgnoreCase

Introduction

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

Prototype

public boolean equalsIgnoreCase(String anotherString) 

Source Link

Document

Compares this String to another String , ignoring case considerations.

Usage

From source file:com.surfs.storage.web.utils.Stringutils.java

public static String convertToKB(String total) {
    if (StringUtils.isBlank(total)) {
        return total;
    }//www .j av  a2  s.  c  o m

    String space = total.substring(0, total.length() - 1);
    String unit = total.substring(total.length() - 1, total.length());

    BigDecimal t = new BigDecimal(space);
    BigDecimal multiply = null;

    if (unit.equalsIgnoreCase("M")) {
        multiply = t.multiply(new BigDecimal("1048576"));
    } else if (unit.equalsIgnoreCase("T")) {
        multiply = t.multiply(new BigDecimal("1099511627776"));
    } else if (unit.equalsIgnoreCase("G")) {
        multiply = t.multiply(new BigDecimal("1073741824"));
    }

    return String.valueOf(multiply.doubleValue());
}

From source file:Main.java

/**
 * To add hack to .3gp file/*w  w w. j av a2 s.  c  o  m*/
 * @param url
 * @return
 */
public static String getAudioMimeType(String url) {
    String type = null;
    String extension = MimeTypeMap.getFileExtensionFromUrl(url);
    Log.w("KKIM", " Sending File Extension = " + extension);
    if (extension != null) {
        if (extension.equalsIgnoreCase("3gp") || extension.equalsIgnoreCase("3gpp")) {
            if (is3gpFileAudio(url)) {
                type = "audio/3gpp";
            } else {
                MimeTypeMap mime = MimeTypeMap.getSingleton();
                type = mime.getMimeTypeFromExtension(extension);
            }
        } else {
            MimeTypeMap mime = MimeTypeMap.getSingleton();
            type = mime.getMimeTypeFromExtension(extension);
        }

        if (type.equalsIgnoreCase("application/ogg")) {
            type = "audio/ogg";
            Log.d("KKIM", "Formatting Audio File Type from application/ogg to audio/ogg");
        }
    }
    return type;
}

From source file:com.glaf.core.util.Tools.java

public static Map<String, Class<?>> getPropertyMap(Class<?> clazz) {
    Map<String, Class<?>> dataMap = new java.util.HashMap<String, Class<?>>();
    PropertyDescriptor[] propertyDescriptor = BeanUtils.getPropertyDescriptors(clazz);
    for (int i = 0; i < propertyDescriptor.length; i++) {
        PropertyDescriptor descriptor = propertyDescriptor[i];
        String propertyName = descriptor.getName();
        if (propertyName.equalsIgnoreCase("class")) {
            continue;
        }/*from  w  w w .jav  a  2s.  c om*/
        dataMap.put(propertyName, descriptor.getPropertyType());
    }
    return dataMap;
}

From source file:com.moviejukebox.model.enumerations.TitleSortType.java

/**
 * Convert a string into an Enum type//w w w. ja v  a2 s .c  o  m
 *
 * @param titleSortTypeString
 * @return TitleSortType
 */
public static TitleSortType fromString(String titleSortTypeString) {
    if (StringUtils.isNotBlank(titleSortTypeString)) {
        for (final TitleSortType titleSortType : EnumSet.allOf(TitleSortType.class)) {
            if (titleSortTypeString.equalsIgnoreCase(titleSortType.toString().toLowerCase())) {
                return titleSortType;
            }
        }
    }
    // We've not found the type, so use the default
    return TitleSortType.TITLE;
}

From source file:Main.java

/**
 * //w  ww  .j a v  a 2  s.co m
 * @param nodelist
 * @param name
 * @return
 */
public static Element getXMLElement(final NodeList nodelist, final String name) {
    Element element = null;
    int size = (nodelist == null) ? 0 : nodelist.getLength();
    for (int i = 0; i < size; i++) {
        element = (Element) nodelist.item(i);
        if (name.equalsIgnoreCase(element.getNodeName())) {
            break;
        }
    }
    return element;
}

From source file:clientapi.util.ClientAPIUtils.java

/**
 * Checks if a string array contains the specified
 * string, non case-sensitive//ww w .ja v  a2s . co m
 *
 * @param array Array of strings being checked
 * @param target String being searched for
 */
public static boolean containsIgnoreCase(String[] array, String target) {
    Objects.requireNonNull(array);
    for (String string : array)
        if (string != null && string.equalsIgnoreCase(target))
            return true;
    return false;
}

From source file:com.claresco.tinman.servlet.XapiServletUtility.java

protected static boolean checkAction(String theAction, String theSupposedAction) {
    return theAction != null && theAction.equalsIgnoreCase(theSupposedAction);
}

From source file:com.davis.ddf.crs.utils.CheckUtil.java

public static boolean checkQueryString(String queryString, CRSEndpointResponse item) {
    boolean result = false;
    if (queryString != null && !queryString.equalsIgnoreCase("%")) {
        String[] queryParams = queryString.split(" ");
        String itemRollUp = item.getClassification() + " " + item.getOriginatorUnit() + " " + item.getSummary()
                + " " + item.getReportLink() + " " + item.getDisplayTitle();
        for (String param : queryParams) {

            if (!STOP_WORDS.contains(param)) {
                if (itemRollUp.contains(param)) {
                    result = true;//w  ww  . ja  v  a  2s.c om
                    break;
                }
            }
        }
    } else {
        result = true;
    }

    return result;
}

From source file:br.ufpr.inf.opla.patterns.util.AdapterUtil.java

public static arquitetura.representation.Class createAdapterClass(Element adaptee) {
    Architecture architecture = ArchitectureRepository.getCurrentArchitecture();
    arquitetura.representation.Class adapterClass;
    arquitetura.representation.Package aPackage = null;

    List<Element> tempElements;

    String namespace = adaptee.getNamespace();
    String packageName = UtilResources.extractPackageName(namespace);

    boolean naArquitetura = packageName.equalsIgnoreCase("model");
    if (naArquitetura) {
        adapterClass = architecture.createClass(adaptee.getName() + "Adapter", false);

        architecture.removeClass(adapterClass);

        tempElements = Collections.unmodifiableList(new ArrayList<>(architecture.getElements()));
    } else {/* w  w w . j  av  a 2s . co m*/
        aPackage = architecture.findPackageByName(packageName);
        adapterClass = aPackage.createClass(adaptee.getName() + "Adapter", false);

        aPackage.removeClass(adapterClass);

        tempElements = Collections.unmodifiableList(new ArrayList<>(aPackage.getElements()));
    }

    adapterClass.setNamespace(adaptee.getNamespace());

    int count = 1;
    String name = adapterClass.getName();
    while (tempElements.contains(adapterClass)) {
        count++;
        adapterClass.setName(name + Integer.toString(count));
    }

    if (naArquitetura) {
        architecture.addExternalClass(adapterClass);
    } else if (aPackage != null) {
        aPackage.addExternalClass(adapterClass);
    }

    return adapterClass;
}

From source file:com.compomics.pride_asa_pipeline.core.repository.factory.FileParserFactory.java

public static FileParser getFileParser(File inputFile) throws IOException {
    currentInputFile = inputFile;/* w ww  .  j a v  a2 s  . c  o m*/
    FileParser parser = null;
    String extension = FilenameUtils.getExtension(inputFile.getAbsolutePath()).toLowerCase();
    //TODO if extension =.gz ---> unzip ---> new extension
    if (extension.equalsIgnoreCase("zip")) {

    } else if (extension.equalsIgnoreCase("gz")) {

    } else if (extension.equalsIgnoreCase("rar")) {

    } else if (extension.equalsIgnoreCase("tar")) {

    }
    switch (extension.toLowerCase()) {
    case "mzid":
        LOGGER.info("Detected mzml file extension.");
        parser = new MzIdentMlParser();
        break;
    case "xml":
        LOGGER.info("Detected xml file extension.");
        parser = new PrideXmlParser();
        break;
    default:
        throw new IOException("Unsupported filetype for parameter-extraction : ." + extension);
    }
    return parser;
}