src/org/nutz/lang/util/Region.java
public Region<T> valueOf(String str) {
        String s2 = Strings.trim(str.substring(1, str.length() - 1));
        leftOpen = str.charAt(0) == '(';
        rightOpen = str.charAt(str.length() - 1) == ')';

        // 只有左值
        if (s2.endsWith(",")) {
            left = fromString(Strings.trim(s2.substring(0, s2.length() - 1)));
            right = null;
        }
        // 只有右值
        else if (s2.startsWith(",")) {
            left = null;
            right = fromString(Strings.trim(s2.substring(1)));
        }
        // 两侧都有值
        else {
            String[] ss = Strings.splitIgnoreBlank(s2, ",");
            // 精确的值
            if (1 == ss.length) {
                left = fromString(ss[0]);
                right = left;
            }
            // 一个区间
            else {
                left = fromString(ss[0]);
                right = fromString(ss[1]);
                // 看看是否需要交换交换...
                if (null != left && null != right && left.compareTo(right) > 0) {
                    T o = right;
                    right = left;
                    left = o;
                }
            }
        }
        return this;
    }
public Region<T> valueOf(String str) {
        String s2 = Strings.trim(str.substring(1, str.length() - 1));
        leftOpen = str.charAt(0) == '(';
        rightOpen = str.charAt(str.length() - 1) == ')';

        // 只有左值
        if (s2.endsWith(",")) {
            left = fromString(Strings.trim(s2.substring(0, s2.length() - 1)));
            right = null;
        }
        // 只有右值
        else if (s2.startsWith(",")) {
            left = null;
            right = fromString(Strings.trim(s2.substring(1)));
        }
        // 两侧都有值
        else {
            String[] ss = Strings.splitIgnoreBlank(s2, ",");
            // 精确的值
            if (1 == ss.length) {
                left = fromString(ss[0]);
                right = left;
            }
            // 一个区间
            else {
                left = fromString(ss[0]);
                right = fromString(ss[1]);
                // 看看是否需要交换交换...
                if (null != left && null != right && left.compareTo(right) > 0) {
                    T o = right;
                    right = left;
                    left = o;
                }
            }
        }
        return this;
    }
解析

@param str
字符串
@return 自身