private void doString(Appendable a, String before1, String before2, Object middle, String after) throws IOException {
    if (middle instanceof DelimitedString && ((DelimitedString)middle).size()==0)
      return;
    a.append(before1);
    a.append(before2);
    if (middle instanceof Appender)
      ((Appender)middle).appendTo(a);
    else
      a.append(middle.toString());
    a.append(after);
  }