Possible Duplicate:
Java split() method strips empty strings at the end?
we have a requirement like reading a file content and uploading the data to the database. the file content will be separated by delimiter '|' like this
4000|name|state|city|zip||country|||address||
I can also have null values for certain column for which there is no data in between "|". for example '||' between zip and country. my problem is string.split("//",'|') is taking the in between null values and returning array considering null values as an element. But the trailing '||' after address is not being considered. As used in the example above, when i use string.split("//",'|') i shd get an string array element of array size 11 but i get only 10.the last null is not getting retreived. Can anyone help with the solution?