static public String trimLabel(String s) {
        // Given a string extract a label by trimming punctuation chars
        StringBuffer result = new StringBuffer(s.length());
        //find first feasible char
        int start = -1, end = s.length();
        for (int i=0; i<s.length(); i++) {
            if (isLabelStart(s.charAt(i))) {
                start = i;
                break;
            }
        }
        if (start== -1) return ""; //no label to extract
        end = s.length()-1;
        for (int j = s.length()-1; j > start; j--) {
            if (isLabelEnd(s.charAt(j))) {
                end = j+1;
                break;
            }
        }
        return s.substring(start, end).trim();
    }