I have a file with similar lines as the following:
42|a|b|c|d||f||h|||||||||||||||||||
I need to split by character | so my code does as follows:
String linha42 = "42|a|b|c|d||f||h|||||||||||||||||||";
String[] campos = linha42.split(Pattern.quote("|"));
for(String item : campo){
System.out.println("item: " + item);
}
But when I go through the fields he stops the split in the letter h, as if he does not recognize the others.
Output Ex:
item: 42
item: a
item: b
item: c
item: d
item:
item: f
item:
item: h
Any suggestions?