I am trying to do a split of String array at the i th location. with a regex for 4 or more spaces.
i found a lot of information here and other sites, hence I came up with
String[] parts = titlesAuthor[i].split(" ");
so the split can happen between the title and authors name which contains either 4 or more spaces or does not exist as all.
Example:
titleAuthor[0] = Investigational drugs for autonomic dysfunction in Parkinson's disease Perez-Lloret S
After running the above split, parts[0] is coming up as empty and part[1] has the complete string.
please help!
code :
for (int i = 0; i < nodes.getLength(); i++) { Element element = (Element) nodes.item(i); NodeList title = element.getElementsByTagName("TEXT"); line = (Element) title.item(0); titlesAuthor[i] = getCharacterDataFromElement(line); System.out.println(titlesAuthor[i]); parts = titlesAuthor[i].split(" "); System.out.println(parts[0]); System.out.println(parts[1]); }