protected static void TrimRight(StringBuilder buf) { int len = buf.Length; while (true) { if (len == 0) return; if (buf[--len] != ' ') return; buf.Length = len; } }