Would someone please have a look at my class that simply parses a text file and converts it to a List<String>. I am really after code comment (i.e. its ok but you should - that kind of comment) as I am trying to improve. Thanks,
then, on line 5, we get the last position of the string "." on your string fileName
so if the index is not 0 (line 6) then you make a substring (line 10).
to make the substring, you get by first character (that will be included in the resulting string) the dotIndex (that holds the position of the last dot (.)) and you dont specify a last character, so that you'll have a string that goes from "." to the end of the fileName, now you have the extension.
of course it may not be the best way, but I always use this.