Here you can find the source of isAbsolute(String aPath)
Parameter | Description |
---|---|
aPath | a parameter |
public static boolean isAbsolute(String aPath)
//package com.java2s; public class Main { /**//from w w w . ja v a 2 s .c om * Determine if the given String represents an absolute path by * checking if the string starts with a '/' or * is a URI that starts with a scheme 'scheme:/'. * * @param aPath * @return true if path is absolute, otherwise false. */ public static boolean isAbsolute(String aPath) { boolean absolute = false; String path = aPath.replace('\\', '/'); // the path has a scheme if a colon appears before the first '/' if (path.indexOf(':') > 0 && path.indexOf('/') > path.indexOf(':')) { absolute = true; } // starts with a '/' else if (path.startsWith("/")) //$NON-NLS-1$ { absolute = true; } return absolute; } }