[Opensource] FileUtil.getExtension

Juris Zubkans juris at ri.lv
Tue Nov 11 22:59:19 PST 2003


Hi

getExtension function is not working correctly
if the file name contains more as one dot.
It is because the function looks for first dot in a file name and not the last
one.

for example myfile.name.doc will return name.doc
instead of doc.

just simply change of code

    	while (st.hasMoreTokens()){
    		ext = st.nextToken();
    	}
    	return ext;

should work.

regards
juris




More information about the Opensource mailing list