Could we use `return new File(filename).getName().split("\\.");`? Much simple and won't care about the separator.