Closed jrodl3r closed 9 years ago
Do you mean something like this?
aaaaaa bbbbbbb
aa bbb
aaaa bbbbb
yes
Note, that we can only position with precision up to one character. There is no way to center align precisely when you have both even and odd lengths in the same column. If this is not a concern, the following will do the job:
function center(str, width) {
if (!width) return str
var pad = (width - str.length) >>> 1
return new Array(pad + 1).join(' ') + str
}
// use it like
t.cell('foo', 'bar baz', center)
How difficult do you think it would be to add center alignment on print + transposed output? :beers: