1273 index = m.end();
1274 } else if (matchList.size() == limit - 1) { // last one
1275 String match = input.subSequence(index,
1276 input.length()).toString();
1277 matchList.add(match);
1278 index = m.end();
1279 }
1280 }
1281
1282 // If no match was found, return this
1283 if (index == 0)
1284 return new String[] {input.toString()};
1285
1286 // Add remaining segment
1287 if (!matchLimited || matchList.size() < limit)
1288 matchList.add(input.subSequence(index, input.length()).toString());
1289
1290 // Construct result
1291 int resultSize = matchList.size();
1292 if (limit == 0)
1293 while (resultSize > 0 && matchList.get(resultSize-1).equals(""))
1294 resultSize--;
1295 String[] result = new String[resultSize];
1296 return matchList.subList(0, resultSize).toArray(result);
1297 }
1298
1299 /**
1300 * Splits the given input sequence around matches of this pattern.
1301 *
1302 * <p> This method works as if by invoking the two-argument {@link
1303 * #split(java.lang.CharSequence, int) split} method with the given input
1304 * sequence and a limit argument of zero. Trailing empty strings are
1305 * therefore not included in the resulting array. </p>
1306 *
1307 * <p> The input {@code "boo:and:foo"}, for example, yields the following
1308 * results with these expressions:
1309 *
1310 * <table class="plain" style="margin-left:2em">
1311 * <caption style="display:none">Split examples showing regex and result</caption>
1312 * <thead>
1313 * <tr>
|
1273 index = m.end();
1274 } else if (matchList.size() == limit - 1) { // last one
1275 String match = input.subSequence(index,
1276 input.length()).toString();
1277 matchList.add(match);
1278 index = m.end();
1279 }
1280 }
1281
1282 // If no match was found, return this
1283 if (index == 0)
1284 return new String[] {input.toString()};
1285
1286 // Add remaining segment
1287 if (!matchLimited || matchList.size() < limit)
1288 matchList.add(input.subSequence(index, input.length()).toString());
1289
1290 // Construct result
1291 int resultSize = matchList.size();
1292 if (limit == 0)
1293 while (resultSize > 0 && matchList.get(resultSize-1).isEmpty())
1294 resultSize--;
1295 String[] result = new String[resultSize];
1296 return matchList.subList(0, resultSize).toArray(result);
1297 }
1298
1299 /**
1300 * Splits the given input sequence around matches of this pattern.
1301 *
1302 * <p> This method works as if by invoking the two-argument {@link
1303 * #split(java.lang.CharSequence, int) split} method with the given input
1304 * sequence and a limit argument of zero. Trailing empty strings are
1305 * therefore not included in the resulting array. </p>
1306 *
1307 * <p> The input {@code "boo:and:foo"}, for example, yields the following
1308 * results with these expressions:
1309 *
1310 * <table class="plain" style="margin-left:2em">
1311 * <caption style="display:none">Split examples showing regex and result</caption>
1312 * <thead>
1313 * <tr>
|