Example usage for org.apache.commons.lang3 StringUtils containsNone

List of usage examples for org.apache.commons.lang3 StringUtils containsNone

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils containsNone.

Prototype

public static boolean containsNone(final CharSequence cs, final String invalidChars) 

Source Link

Document

Checks that the CharSequence does not contain certain characters.

A null CharSequence will return true .

Usage

From source file:org.power.commons.io.FileUtils.java

/**
 * ????// ww  w.j  a  v  a  2  s  .  co  m
 *
 * @param path 
 * @return ?
 */
public static FileNameAndExtension getFileNameAndExtension(String path, boolean extensionToLowerCase) {
    path = StringUtils.trimToEmpty(path);

    String fileName = path;
    String extension = null;

    if (!StringUtils.isEmpty(path)) {
        // ?index >= 0extension != null?name.
        int index = path.lastIndexOf('.');

        if (index >= 0) {
            extension = StringUtils.trimToNull(StringUtils.substring(path, index + 1));

            if (!StringUtils.containsNone(extension, "/\\")) {
                extension = null;
                index = -1;
            }
        }

        if (index >= 0) {
            fileName = StringUtils.substring(path, 0, index);
        }
    }

    return new FileNameAndExtension(fileName, extension, extensionToLowerCase);
}

From source file:org.yamj.core.service.metadata.online.ImdbScanner.java

private static void parseCredits(VideoData videoData, JobType jobType, String xml, String creditsMatch) {
    if (StringUtils.indexOf(xml, HTML_GT + creditsMatch) > 0) {
        for (String member : HTMLTools.extractTags(xml, HTML_GT + creditsMatch, HTML_TABLE_END, HTML_A_START,
                HTML_A_END, Boolean.FALSE)) {
            int beginIndex = member.indexOf("href=\"/name/");
            if (beginIndex > -1) {
                String personId = member.substring(beginIndex + 12, member.indexOf("/", beginIndex + 12));
                String name = StringUtils
                        .trimToEmpty(member.substring(member.indexOf(HTML_GT, beginIndex) + 1));
                if (!name.contains("more credit") && StringUtils.containsNone(name, "<>:/")) {
                    videoData.addCreditDTO(new CreditDTO(SCANNER_ID, personId, jobType, name));
                }/*from w w  w  .  j  a v a  2s.  c om*/
            }
        }
    }
}