Utils.java Source code

Java tutorial

Introduction

Here is the source code for Utils.java

Source

public class Utils {

    public static final String ANCHOR_CHAR = "#"; //$NON-NLS-1$

    /**
     * Returns the anchor value of the given URL.
     * 
     * @param url
     *          URL
     * @return anchor value, or null if none was defined
     */
    public static String getAnchor(String url) {
        if (url != null) {
            int anchorPosition = url.indexOf(ANCHOR_CHAR);
            if (anchorPosition >= 0) {
                return url.substring(anchorPosition + 1);
            }
        }
        return null;
    }

}