4
I have a file with lines similar to the one below:
42|a|b|c|d||f||h|||||||||||||||||||
I need to split by character | then my code does it like this:
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 splitting the letter h, as if he didn’t recognize the others.
Output ex:
item: 42
item: a
item: b
item: c
item: d
item:
item: f
item:
item: h
Any suggestions ?
You need empty characters to appear on all those coming after h?
– Pablo Almeida
Yes, even if there’s nothing between the | I need to identify.
– hebertrfreitas