function d3_collapse(s) { return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " "); }