最好有详细的讲解。有java和jsp 的代码。
------解决方案--------------------
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));
}