日期:2014-05-18 浏览次数:20799 次
public static String getExtension(String filename) {
if ((filename != null) && (filename.length() > 0)) {
int dot = filename.lastIndexOf('.');
if ((dot >-1) && (dot < (filename.length() - 1))) {
return filename.substring(dot + 1);
}
}
return filename;
}
public static void main(String[] args) {
String filename = "xxx.doc";
System.out.println(getExtension(filename));
}