Gets the name from the specified path. @param path the full path @return the name alone
(String path)
| 226 | * @return the name alone |
| 227 | */ |
| 228 | public static String getName(String path) { |
| 229 | if(path==null) { |
| 230 | return ""; //$NON-NLS-1$ |
| 231 | } |
| 232 | // remove path |
| 233 | int i = path.lastIndexOf("/"); //$NON-NLS-1$ |
| 234 | if(i==-1) { |
| 235 | i = path.lastIndexOf("\\"); //$NON-NLS-1$ |
| 236 | } |
| 237 | if(i!=-1) { |
| 238 | return path.substring(i+1); |
| 239 | } |
| 240 | return path; |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * Gets the extension of the specified file name. |
no outgoing calls