public static String[] split(final String str, final char separator, final boolean preserveAllTokens) {
        if (str == null) {
            return null;
        }
        final int len = str.length();
        if (len == 0) {
            return EMPTY_STRING_ARRAY;
        }
        final List<String> list = Lists.newArrayList();
        int i = 0, start = 0;
        boolean match = false;
        while (i < len) {
            if (str.charAt(i) == separator) {
                if (match || preserveAllTokens) {
                    list.add(str.substring(start, i));
                    match = false;
                }
                start = ++i;
                continue;
            }
            match = true;
            i++;
        }
        if (match || preserveAllTokens) {
            list.add(str.substring(start, i));
        }
        return list.toArray(new String[0]);
    }
Splits the provided text into an array, separator specified,
if {@code} true, preserving all tokens, including empty tokens created
by adjacent separators.

A null input String returns null.

Strings.split(null, *, true)         = null
Strings.split("", *, true)           = []
Strings.split("a.b.c", '.', true)    = ["a", "b", "c"]
Strings.split("a..b.c", '.', true)   = ["a", "", "b", "c"]
Strings.split("a:b:c", '.', true)    = ["a:b:c"]
Strings.split("a b c", ' ', true)    = ["a", "b", "c"]
Strings.split("a b c ", ' ', true)   = ["a", "b", "c", ""]
Strings.split("a b c  ", ' ', true)  = ["a", "b", "c", "", ""]
Strings.split(" a b c", ' ', true)   = ["", a", "b", "c"]
Strings.split("  a b c", ' ', true)  = ["", "", a", "b", "c"]
Strings.split(" a b c ", ' ', true)  = ["", a", "b", "c", ""]
jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/util/Strings.java