I may just be dead wrong, but I've used String.split(String) for a very long time and I've never ran into an issue with this, basically I'm trying to split a string by a period, and return it into an array called breadcrumbs
Current code:
String[] breadcrumbs = file.toString()
.replaceAll(".java", "")
.replaceAll("\\\\", ".")
.split(".");
System.out.println("Length: " + breadcrumbs.length);
The length returns zero,
Now, if I take the .split(".") off and make breadcrumbs a regular string, like so:
String breadcrumbs = file.toString()
.replaceAll(".java", "")
.replaceAll("\\\\", ".");
System.out.println(breadcrumbs);
It prints out a perfectly good directory, using periods (Like I want), here's the output:
C:.Users.Jellal.Desktop.Java Workspace.ogserver-framework.src.test.com.chris.server.user.Account
So, as you can see we have a perfectly good string to work with, taking it into account that this worked, and the "Single-line" code I posted first didn't, I tried it while it was seperated, like so:
String fileDir = file.toString()
.replaceAll(".java", "")
.replaceAll("\\\\", ".");
String[] breadcrumbs = fileDir.split(".");
System.out.println(fileDir);
System.out.println(breadcrumbs.length);
This generates the following output:
C:.Users.Jellal.Desktop.Java Workspace.ogserver-framework.target.test-classes.com.chris.server.user.Account.class
0
Not exactly sure what's going on here, but it seems broken.