code: public static String canonicalID(String id) {
          if (id == null)
              return "";
          int st = 0;
          int len = id.length();
          boolean substr = false;
          int c;
          while (st < len && ((c = id.charAt(st)) == '<' ||
                              c <= ' ')) {
              st++;
              substr = true;
          }
          while (st < len && ((c = id.charAt(len - 1)) == '>' ||
                              c <= ' ')) {
              len--;
              substr = true;
          }
          return substr ? id.substring(st, len) : id;
      }
docs: Convert a message-id string to canonical form (strips off
  leading and trailing <>s)