Skip to content

Extend some helpers to String class. String#slug, String#fill, String#apostrophe...

Notifications You must be signed in to change notification settings

raphaelivan/string_helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StringHelpers

StringHelpers extend some instance methods to String class

Install

gem install string_helpers

or add to your Gemfile

gem string_helpers

Usage

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"

License

StringHelper is available under the MIT license.

About

Extend some helpers to String class. String#slug, String#fill, String#apostrophe...

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages