code: private static List<String> splitOuter(String str, char sepChr) {
          List<String> result = new ArrayList<String>();
          StringBuilder buffer = new StringBuilder();
          int nesting = 0;
          boolean bInQuote = false;
          for (int index = 0; index < str.length(); index++) {
              char ch = str.charAt(index);
              switch (ch) {
              case '(':
                  buffer.append(ch);
                  nesting++;
                  break;
              case ')':
                  buffer.append(ch);
                  nesting--;
                  break;
              case '\'':
              case '"':
                  buffer.append(ch);
                  if (bInQuote) {
                      nesting--;
                  } else {
                      nesting++;
                  }
                  bInQuote = !bInQuote;
                  break;
              case ',':
                  if (nesting == 0) {
                      result.add(buffer.toString());
                      buffer.setLength(0);
                  } else {
                      buffer.append(ch);
                  }
                  break;
              default:
                  buffer.append(ch);
              }
          }
          if (buffer.length() > 0) {
              result.add(buffer.toString());
          }
          return result;
      }
docs: Split the given string at sepChr occurrences outside of parens/quotes.