1

I want transform a string that it is slugified in another string that it is the equivalent in human readable?

I take the parametesr from an url:

bookmark/10/disco%20asdasd

So I have the nome that is "disco%20asdasd". But in this way it not confrontable so I need to convert "disco%20asdasd" in "disco asdasd" that is the operation opposite to slugify. Anyone can help me?

Picco
  • 423
  • 2
  • 6
  • 21
  • 2
    I don't know if you want, but I presume you do since you're asking here :) Wording apart, this is not a code writing service. You should edit the question and post sample data (input and output) together with the code you've got so far and explanations of where you're stuck. – Álvaro González Mar 20 '17 at 16:17
  • 1
    So you don't need slugify - you need URL decoding. See [my updated answer](http://stackoverflow.com/questions/42908645/how-can-i-convert-a-string-slugify-in-the-equivalent-in-human/42908749#42908645) below. – rsp Mar 20 '17 at 16:24

1 Answers1

0

It would really help if you showed an example of a string that you want to convert and an example of a string that you want to convert it to. Without that I can only recommend you some general solutions. See:

See the code examples in the docs of those projects.

Update

If you want to convert: disco%20asdasd to: disco asdasd then use:

let decoded = decodeURI(yourString);

or:

let decoded = decodeURIComponent(yourString);

but this is not a slug - this is URI-encoding and decoding.

See:

More info on Wikipedia:

rsp
  • 107,747
  • 29
  • 201
  • 177