Problem splitting a string
I am trying to split up a filename into parts:
Code:
String filename = file.getName();
System.out.println("File: "+filename);
String[] parts = filename.split(".");
System.out.println(parts[0]);
My output is:
File: hello.txt
Then I get an indexoutOfBounds exception when trying to print out parts[0].
I even went so far as to iterate over each character in the filename string and keep a count of the "." instances, and it gives me back a 1 so I know it recognizes the period...not sure whats going on.