Example usage for java.lang String endsWith

List of usage examples for java.lang String endsWith

Introduction

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

Prototype

public boolean endsWith(String suffix) 

Source Link

Document

Tests if this string ends with the specified suffix.

Usage

From source file:at.beris.virtualfile.util.UrlUtils.java

public static String getParentPath(String urlPath) {
    if (urlPath.endsWith("/"))
        urlPath = urlPath.substring(0, urlPath.lastIndexOf('/'));
    String parentPath = urlPath.substring(0, urlPath.lastIndexOf('/') + 1);
    return parentPath;
}

From source file:at.beris.virtualfile.util.UrlUtils.java

public static String getLastPathPart(String urlPath) {
    if (urlPath.endsWith("/"))
        urlPath = urlPath.substring(0, urlPath.lastIndexOf('/'));
    String urlPart = urlPath.substring(urlPath.lastIndexOf('/') + 1);
    return urlPart;
}

From source file:edu.rice.cs.bioinfo.programs.phylonet.PhyloNetAAT.java

public static TestSuite suite() throws Throwable {
    TestSuite aatSuite = new TestSuite();

    File currentDir = new File(".");

    for (final File file : currentDir.listFiles(new FilenameFilter() {
        public boolean accept(File dir, String name) {
            return name.endsWith(".txt");
        }//from  www.ja  v a2s.  c o m
    })) {

        new AATTestCase(file).runTest();

    }

    return aatSuite;
}

From source file:Main.java

public static MediaMetadataRetriever initMetadataRetriever(String URI) {
    MediaMetadataRetriever retriever = new MediaMetadataRetriever();
    if (!URI.contains("http:") && URI.endsWith("mp3")) {
        try {//from  www  .jav  a 2  s  . c o m
            retriever.setDataSource(URI);
        } catch (Exception e) {
            Log.d(LOG_TAG, "Failed: " + URI + " " + e.toString());
            e.printStackTrace();
            return null;
        }
    } else {
        return null;
    }
    return retriever;
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.device.FirmwareLocation.java

private static String cleanUpDomain(final String domain) {
    String cleanDomain = domain;

    while (cleanDomain.endsWith("/")) {
        cleanDomain = cleanDomain.substring(0, cleanDomain.length() - 1);
    }//from   w  w w. j a v a  2  s  .c  om

    if (cleanDomain.contains("://")) {
        cleanDomain = cleanDomain.substring(cleanDomain.lastIndexOf("://") + 3);
    }

    return cleanDomain;
}

From source file:com.clothcat.sysutils.files.Basename.java

public static void basename(String[] args) {
    parseOptions(args);//from   ww w .j  a  va2  s. com
    if (commandLine.hasOption("help")) {
        help();
        // exit early
        return;
    } else if (commandLine.hasOption("version")) {
        version();
        // exit early
        return;
    } else {
        if (commandLine.hasOption("multiple")) {
            multiple = true;
        }
        if (commandLine.hasOption("suffix")) {
            suffix = commandLine.getOptionValue("suffix");
        }
        if (commandLine.hasOption("zero")) {
            zero = true;
        }
        filenames = commandLine.getArgList();
    }
    String pathSep = System.getProperty("file.separator");
    char separator = (zero) ? '\0' : '\n';
    for (String s : filenames) {
        if (suffix != null && s.endsWith(suffix)) {
            s = s.substring(0, s.length() - suffix.length() - 1);
        }
        String[] parts = s.split(pathSep);
        System.out.print(parts[parts.length - 1] + separator);
    }
    System.out.println();
}

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;//from   ww w  .j  a v  a2s  .c  om

    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;/*from w w  w  .  ja v a2s  .  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  w  w w. j a  va 2s . co  m*/

    return retVal;
}

From source file:com.squarespace.template.plugins.platform.CommerceUtilsTest.java

private static List<String> extractTests(Map<String, JsonNode> jsonMap) {
    List<String> tests = new ArrayList<>();
    for (String key : jsonMap.keySet()) {
        if (!key.endsWith("-expected")) {
            tests.add(key);// w w  w.  j a  v  a 2  s.  c o m
        }
    }
    return tests;
}