Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby slugalizer ("Föö Bár!" -> "foo-bar"). Uses ActiveSupport for platform-consistent normalization. Originally by Christoffer Sawicki.
Ruby
tree: 07391b4e54

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.markdown
slugalizer.rb

README.markdown

Slugalizer is a one-method Ruby library that can slugalize (or slugify) strings, like this:

Slugalizer.slugalize("Åh, räksmörgåsar!")
# => "ah-raksmorgasar"

Defaults to the "-" word separator but can also use "+" or "_":

Slugalizer.slugalize("Åh, räksmörgåsar!", "+")
# => "ah+raksmorgasar"

Slugalizer.slugalize("Åh, räksmörgåsar!", "_")
# => "ah_raksmorgasar"

Uses ActiveSupport::Multibyte::Handlers::UTF8Handler (part of Ruby on Rails since 1.2) for platform-consistent normalization/decomposition, since iconv from the Ruby standard library is inconsistent between platforms.

Originally by Christoffer Sawicki.

Modified by Henrik Nyh.

Released into the public domain.

Something went wrong with that request. Please try again.