I am writing a program that, given a file consisting of words and associated objects, creates a dictionary. For instance, I may have the word "Apple" associated with the String object "A red fruit"
Now, some of the objects are image files, and some are audio files. Of the image files, only the extensions ".jpg" and ".gif" will be considered (i.e. included in the file). Likewise, for the audio files, only ".wav" and ".mid" will be considered.
I have classes to handle displaying the image files and playing the audio files already, but I am now trying to figure out (when inputting the information) how to detect if an object is an image or audio file, or if it is neither. I was thinking of somehow checking the last three characters of the object, so for instance if it is "jpg" then I would mark it as an image type object. Or, if it was "uit" as in the "Apple" example above, then it would be marked as neither. However, I don't know how to check only the last three characters of a string. Is there some built-in method to do this String check automatically?