Example usage for java.lang String lastIndexOf

List of usage examples for java.lang String lastIndexOf

Introduction

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

Prototype

public int lastIndexOf(String str) 

Source Link

Document

Returns the index within this string of the last occurrence of the specified substring.

Usage

From source file:com.sangupta.shire.util.ShireUtils.java

/**
 * Method that creates a unique ID for this post.
 * For now, we remove the last extension
 *///w w w  . j a  v a 2  s . c  om
public static String createUniquePageID(String url) {
    int index = url.lastIndexOf('.');
    if (index != -1) {
        return url.substring(0, index);
    }

    return url;
}