Thursday, August 11, 2011

Java coding help with file extension?

I'm not sure what you were trying to do in your getExtension(String) method. The simplest way to return everything after the last period would be to return str.substring ( str.lastIndexOf('.') + 1 ). Just one line of code. If the string and substring are equivalent, then the given filename has no extension.

No comments:

Post a Comment