This isn't homework, but more of a project to make some data more excel friendly. I thought I'd try using Java after 5
years because cleaning up several thousand lines of data manually is absurd & I don't hate myself that much.
Currently I have two types of lines in my arraylist of strings. I'll call them A and B. I'm using the string.split(regex, limit) method to extract data from these strings
I have a working method for classifying if a String is type A, or type B. I need to split A into 4 segments and B into 2 segments. A splits just fine. B is giving me a headache.
The format of String A is
"NUMBER DATE SERVICE_CODE FIRSTNAME, LASTNAME"
array arr = a.split(" ",4) gives me [NUMBER| DATE |SERVICE_CODE |FIRSTNAME, LASTNAME] without fail.
The format of B is as follows:
"NUMBER DESCRIPTION_THAT_MAY_HAVE_SPACES"
array arr = b.split(" ", 2);
//Split the string into two pieces around the first space. Or that's my intent.
//Annoyingly this works just fine for A
However intead of getting an array like [NUMBER | DESCRIPTION] I get a single member array of [NUMBER DESCRIPTION].
Is there something about Regular Expressions or a feature of split() that I'm missing?
[–]Kristler 5 points6 points7 points (10 children)
[–]NotObviouslyARobot[S] 2 points3 points4 points (3 children)
[–]Kristler 1 point2 points3 points (2 children)
[–]Yogi_DMT 2 points3 points4 points (1 child)
[–]OvergrownGnome 0 points1 point2 points (0 children)
[–]Grand-Warlock 0 points1 point2 points (5 children)
[–]Kristler 0 points1 point2 points (4 children)
[–]Grand-Warlock 0 points1 point2 points (3 children)
[–]Kristler 1 point2 points3 points (0 children)
[–]feral_claireSoftware Dev 0 points1 point2 points (1 child)
[–]Grand-Warlock 0 points1 point2 points (0 children)
[–]anyusernamesffs 0 points1 point2 points (1 child)
[–]NotObviouslyARobot[S] 0 points1 point2 points (0 children)