Sha256: 09f87865642b6fb1cde12c749334d6e245642a368896e8998cfbe3b08459354c
Contents?: true
Size: 316 Bytes
Versions: 3
Compression:
Stored size: 316 Bytes
Contents
class String def rpad(n,pad_char=" ") return self if length >= n pad = pad_char * (n-length) self + pad end def lpad(n,pad_char=" ") return self if length >= n pad = pad_char * (n-length) pad + self end end class Numeric def lpad(n,pad_char="0") to_s.lpad(n,pad_char) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mharris_ext-1.7.1 | lib/mharris_ext/string.rb |
mharris_ext-1.7.0 | lib/mharris_ext/string.rb |
mharris_ext-1.6.0 | lib/mharris_ext/string.rb |