diff --git a/challenges/slugify/README.md b/challenges/slugify/README.md new file mode 100644 index 0000000..0b9525c --- /dev/null +++ b/challenges/slugify/README.md @@ -0,0 +1,60 @@ +# slugify + +Created by [@Divlo](https://github.com/Divlo) on 10 November 2021. + +## Instructions + +Write a function that generates a slug from a string. + +A Slug is the unique identifying part of a web address, typically at the end of the URL. + +The rules for generating a slug are as follows (`kebab-case`): + +- Replace spaces with hyphens. +- Remove all non-alphanumeric characters. + +## Examples + +### Example 1 + +#### Input + +```txt +hello world +``` + +#### Output + +```txt +hello-world +``` + +### Example 2 + +#### Input + +```txt +--hello world-- +``` + +### Output + +```txt +hello-world +``` + +### Example 3 + +#### Input + +```txt +😄 emoji +``` + +### Output + +```txt +emoji +``` + +See the `test` folder for examples of input/output. diff --git a/challenges/slugify/solutions/.gitkeep b/challenges/slugify/solutions/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/challenges/slugify/test/1/input.txt b/challenges/slugify/test/1/input.txt new file mode 100644 index 0000000..95d09f2 --- /dev/null +++ b/challenges/slugify/test/1/input.txt @@ -0,0 +1 @@ +hello world \ No newline at end of file diff --git a/challenges/slugify/test/1/output.txt b/challenges/slugify/test/1/output.txt new file mode 100644 index 0000000..bdd51cc --- /dev/null +++ b/challenges/slugify/test/1/output.txt @@ -0,0 +1 @@ +hello-world \ No newline at end of file diff --git a/challenges/slugify/test/2/input.txt b/challenges/slugify/test/2/input.txt new file mode 100644 index 0000000..4eaa6c2 --- /dev/null +++ b/challenges/slugify/test/2/input.txt @@ -0,0 +1 @@ +--hello world-- \ No newline at end of file diff --git a/challenges/slugify/test/2/output.txt b/challenges/slugify/test/2/output.txt new file mode 100644 index 0000000..bdd51cc --- /dev/null +++ b/challenges/slugify/test/2/output.txt @@ -0,0 +1 @@ +hello-world \ No newline at end of file diff --git a/challenges/slugify/test/3/input.txt b/challenges/slugify/test/3/input.txt new file mode 100644 index 0000000..5f22af0 --- /dev/null +++ b/challenges/slugify/test/3/input.txt @@ -0,0 +1 @@ +😄 emoji \ No newline at end of file diff --git a/challenges/slugify/test/3/output.txt b/challenges/slugify/test/3/output.txt new file mode 100644 index 0000000..d8ff5aa --- /dev/null +++ b/challenges/slugify/test/3/output.txt @@ -0,0 +1 @@ +-emoji \ No newline at end of file diff --git a/challenges/slugify/test/4/input.txt b/challenges/slugify/test/4/input.txt new file mode 100644 index 0000000..ad4986b --- /dev/null +++ b/challenges/slugify/test/4/input.txt @@ -0,0 +1 @@ + slug \ No newline at end of file diff --git a/challenges/slugify/test/4/output.txt b/challenges/slugify/test/4/output.txt new file mode 100644 index 0000000..cbdaa4e --- /dev/null +++ b/challenges/slugify/test/4/output.txt @@ -0,0 +1 @@ +slug \ No newline at end of file diff --git a/challenges/slugify/test/5/input.txt b/challenges/slugify/test/5/input.txt new file mode 100644 index 0000000..453ef45 --- /dev/null +++ b/challenges/slugify/test/5/input.txt @@ -0,0 +1 @@ +slugify \ No newline at end of file diff --git a/challenges/slugify/test/5/output.txt b/challenges/slugify/test/5/output.txt new file mode 100644 index 0000000..453ef45 --- /dev/null +++ b/challenges/slugify/test/5/output.txt @@ -0,0 +1 @@ +slugify \ No newline at end of file diff --git a/challenges/slugify/test/6/input.txt b/challenges/slugify/test/6/input.txt new file mode 100644 index 0000000..3d1ec8d --- /dev/null +++ b/challenges/slugify/test/6/input.txt @@ -0,0 +1 @@ +programming-challenges \ No newline at end of file diff --git a/challenges/slugify/test/6/output.txt b/challenges/slugify/test/6/output.txt new file mode 100644 index 0000000..3d1ec8d --- /dev/null +++ b/challenges/slugify/test/6/output.txt @@ -0,0 +1 @@ +programming-challenges \ No newline at end of file