public static List<String> splitOnCharacterAsList(String value, char needle, int count) {
        // skip leading and trailing needles
        int end = value.length() - 1;
        boolean skipStart = value.charAt(0) == needle;
        boolean skipEnd = value.charAt(end) == needle;
        if (skipStart && skipEnd) {
            value = value.substring(1, end);
            count = count - 2;
        } else if (skipStart) {
            value = value.substring(1);
            count = count - 1;
        } else if (skipEnd) {
            value = value.substring(0, end);
            count = count - 1;
        }

        List<String> rc = new ArrayList<>(count);
        int pos = 0;
        for (int i = 0; i < count; i++) {
            end = value.indexOf(needle, pos);
            if (end != -1) {
                String part = value.substring(pos, end);
                pos = end + 1;
                rc.add(part);
            } else {
                rc.add(value.substring(pos));
                break;
            }
        }
        return rc;
    }
@Test
    public void testSplitOnCharacterAsList() {
        List<String> list = splitOnCharacterAsList("foo", ',', 1);
        assertEquals(1, list.size());
        assertEquals("foo", list.get(0));

        list = splitOnCharacterAsList("foo,bar", ',', 2);
        assertEquals(2, list.size());
        assertEquals("foo", list.get(0));
        assertEquals("bar", list.get(1));

        list = splitOnCharacterAsList("foo,bar,", ',', 3);
        assertEquals(2, list.size());
        assertEquals("foo", list.get(0));
        assertEquals("bar", list.get(1));

        list = splitOnCharacterAsList(",foo,bar", ',', 3);
        assertEquals(2, list.size());
        assertEquals("foo", list.get(0));
        assertEquals("bar", list.get(1));

        list = splitOnCharacterAsList(",foo,bar,", ',', 4);
        assertEquals(2, list.size());
        assertEquals("foo", list.get(0));
        assertEquals("bar", list.get(1));

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 100; i++) {
            sb.append(i);
            sb.append(",");
        }
        String value = sb.toString();

        int count = StringHelper.countChar(value, ',') + 1;
        list = splitOnCharacterAsList(value, ',', count);
        assertEquals(100, list.size());
        assertEquals("0", list.get(0));
        assertEquals("50", list.get(50));
        assertEquals("99", list.get(99));
    }