Subject: [ruby-talk:16648] cjust?
From: Robert Feldt <feldt ce.chalmers.se>
Date: Thu, 21 Jun 2001 00:43:16 +0900
Hi,
We have ljust and rjust so why not:
class String
def cjust(width)
w = width - length
w > 0 ? rjust(length+w/2+w%2).ljust(width) : self
end
end
Maybe we're on track for feature bloat here but... ;-)
/Robert