21 package org.matsim.core.utils.misc;
54 public static String[]
explode(
final String str,
final char delimiter,
final int limit) {
56 int len = str.length();
58 int countAtMaxPos = 0;
59 int upperLimit = limit-1;
61 for (
int pos = 0; pos < len; pos++) {
62 if ((str.charAt(pos) == delimiter) && (limit == 0 || count < upperLimit)) {
66 countAtMaxPos = count;
71 String[] parts =
new String[1];
77 String[] parts =
new String[countAtMaxPos + 1];
81 for (
int pos = 0; pos < maxPos; pos++) {
82 if ((str.charAt(pos) == delimiter) && (limit == 0 || count < upperLimit)) {
83 parts[count] = str.substring(startPos, pos);
93 parts[count] = str.substring(startPos, maxPos+1);
112 public static String[]
explode(
final String str,
final char delimiter) {
113 return explode(str, delimiter, 0);
static String [] explode(final String str, final char delimiter)
static String [] explode(final String str, final char delimiter, final int limit)