Wolfram Computation Meets Knowledge

SlugifyString

Contributed by: Cody Woodard

Process strings to make them more URL-friendly

ResourceFunction["SlugifyString"][string]

gives url-friendly version of string.

ResourceFunction["SlugifyString"][string, options]

gives url-friendly version of string.

Details and Options

The following options can be given:
"ForceLowerCase" True force string to be lower-case
IgnoreDiacritics False if True,transliterate string
"SeparatorCharacter" "-" character that replaces non-WordCharacters

Examples

Basic Examples

Create a URL-friendly version of a string:

In[1]:=
ResourceFunction["SlugifyString"]["This is a sample title"]
Out[1]=

Scope

By default, this function transliterates into plain ASCII:

In[2]:=
ResourceFunction["SlugifyString"]["Vigenère Cipher"]
Out[2]=

This function removes symbols, but keeps letters and numbers:

In[3]:=
ResourceFunction[
 "SlugifyString"]["We\[CloseCurlyQuote]ve Come a Long Way in 30 Years \
(But You Haven\[CloseCurlyQuote]t Seen Anything Yet!)"]
Out[3]=

Options

Don’t force lower-case:

In[4]:=
ResourceFunction["SlugifyString"]["This Is A Sample Title", "ForceLowerCase" -> False]
Out[4]=

Don’t transliterate:

In[5]:=
ResourceFunction["SlugifyString"]["Vigenère Cipher", IgnoreDiacritics -> True]
Out[5]=

Use a different separator character:

In[6]:=
ResourceFunction["SlugifyString"]["This is a sample title", "SeparatorCharacter" -> "_"]
Out[6]=

Combining options:

In[7]:=
ResourceFunction["SlugifyString"]["This Is A Sample Title", "ForceLowerCase" -> False, "SeparatorCharacter" -> ""]
Out[7]=

Resource History