vibe.d beta banner
get vibe.d

Asynchronous I/O that doesn’t get in your way, written in D

Function asSlug

Generates an identifier suitable to use as within a URL.

auto asSlug(R) (
  R text
if (isInputRange!R && is(typeof(R.init.front) == dchar));

The resulting string will contain only ASCII lower case alphabetic or numeric characters, as well as dashes (-). Every sequence of non-alphanumeric characters will be replaced by a single dash. No dashes will be at either the front or the back of the result string.


Sönke Ludwig


© 2012-2019 Sönke Ludwig


Subject to the terms of the MIT license, as written in the included LICENSE.txt file.