Welcome To Snipplr
Everyone's Recent Ruby Snippets Tagged format
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
« Prev 1 Next »
This is an extension to Ruby's String class. Just put this code in a file and include it. This basically takes a string and adds literals and padding to it. For example, you can format a phone number with optional area code like this:
"5445556...
1
883
posted 17 years ago by Agent
« Prev 1 Next »