| 5137 | } |
| 5138 | |
| 5139 | private static final void parseTXTLine(List<int[]> positions, List<String[]> result, String string, String nullLiteral) { |
| 5140 | String[] fields = new String[positions.size()]; |
| 5141 | result.add(fields); |
| 5142 | int length = string.length(); |
| 5143 | |
| 5144 | for (int i = 0; i < fields.length; i++) { |
| 5145 | int[] position = positions.get(i); |
| 5146 | |
| 5147 | if (position[0] < length) |
| 5148 | fields[i] = string.substring(position[0], Math.min(position[1], length)).trim(); |
| 5149 | else |
| 5150 | fields[i] = null; |
| 5151 | |
| 5152 | if (StringUtils.equals(fields[i], nullLiteral)) |
| 5153 | fields[i] = null; |
| 5154 | } |
| 5155 | } |
| 5156 | |
| 5157 | private static final Pattern P_PARSE_HTML_ROW = Pattern.compile("<tr>(.*?)</tr>"); |
| 5158 | private static final Pattern P_PARSE_HTML_COL_HEAD = Pattern.compile("<th>(.*?)</th>"); |