StringHelpers extend some instance methods to String class
gem install string_helpers
or add to your Gemfile
gem string_helpers
Slug
"Jhon Doe".slug! #=> "Jhon-Doe"
Slugged?
"Jhon Doe".slugged? #=> false
"Jhon-Doe".slugged? #=> true
"Jhon---".slugged? #=> true
"Jhon".slugged? #=> true
Fill
"Jhon Doe".fill!(10) #=> "Jhon Doe "
"Jhon Doe".fill(5) #=> "Jhon..."
Apostrophe's
"Jhon Doe".apostrophe! #=> "Jhon Doe’s"
"Marrys".apostrophe! #=> "Marrys’"
Camelize
"jhon doe and marry".camelize! #=> "JhonDoeAndMarry"
Blank?
" ".blank? #=> true
" a".blank? #=> false
Blank!
" a".blank! #=> ""
Camelize
"jhon doe and marry".camelize! #=> "JhonDoeAndMarry"
StringHelper is available under the MIT license.