Ok, so my problem is that I want to be able to parse a string and split it, keeping some delimiters and deleting others.
Let's say my input string is 1.8.0a
. I want to be able to put the string into an array,
[1, 8, 0, a]
. I've seen other SO questions, and the best answer is close to what I want. My current code is:
String[] array = s.split("[-._[?<=a[b[r]]]]");
The only problem is that my output is
[1, 8, 0]
EDIT:
Here's a few more examples:
Input: 1.18.0a
Output: [1, 18, 0]
Expected output: [1, 18, 0, a]
Input: 1.22.0r
Output: [1, 22, 0]
Expected output: [1, 22, 0, r]
Also, I used parenthesis,
String[] array = s.split("[-._(?<=a[b[r]])]");
Still to no avail.