I trying to get a specific data from a line that using ! as split. For example:
S!ARC!256!547291!840.50!9038.00!840.50!9038.00!519.50!9038.00!321.00!0.00!COUNTERCLOCKWISE!ASSEMBLY_TOP!BAT-2-CR1632-T0_R!BT2K!
so when i split the line using ! and put it in array, the array should contain 16 data. But i facing problem that when data like
S!LINE!257!37825 1!3525.00!10720.00!4525.00!10720.00!6.00!!!!!ASSEMBLY_TOP!CSCO-LABEL-ASY-73-SN-COMB_R!!
and it ignore the last data which is null or "". So when i try to take the data[15] , the problem ArrayIndexOutOfBoundsException keep pop out.Below are some code that i write:
String[] data = $LINE_LIST.get(k).split("!");
if ($LINE_LIST.get(k).startsWith("S!") && $LINE_LIST.get(k).contains("ASSEMBLY_TOP"))
{
$GRAPHIC.append(data[15])
.append("!")
.append(data[14])
.append("!")
.append("TOP")
.append("\n");
}
Any way to solve this problem??