String.split() accepts a regular expression, so if you want to split by special character you need to escape . for it not to be considered as a regex meta character. For example, if you have the filename as:

SomeFile.jpg, to get its extension you’ll need to: