-
-
Save elim/2070 to your computer and use it in GitHub Desktop.
strimwidth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def strimwidth(width) | |
self.split(//)[0...width].join | |
end | |
end | |
#see also http://www.ruby-lang.org/ja/man/html/Array.html#self.5bstart.2e.2eend.5d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment