-2

Possible Duplicate:
How can I decode a URL with jQuery?

Could somebody please help me to take a string (i.e. URL parameter) and remove the +(plus) or %20 to a regular space (" ")?

For example, to change this:

"my+string+to+change" or "my%20string%20to%20change"

to this:

"my string to change"

I use a lot of jQuery already, so that would be fine. Or pure javascript if that's easier.

Community
  • 1
  • 1
Richard Harris
  • 929
  • 3
  • 8
  • 14
  • 1
    For what it's worth please see the `decodeURIcomponent` in action here : http://jsfiddle.net/Rxa5C/ – Ashutosh Jindal Aug 01 '12 at 16:54
  • I really don't appreciate being downvoted for this. I disagree that this is an "exact duplicate" and in fact did not get an answer from the linked page. My question is not about a URL but about changing a string. – Richard Harris Aug 08 '12 at 10:20

1 Answers1

2

Use decodeURIcomponent(stringToDecode)

Note this is not a jquery feature but a regular javascript function.

Mike Brant
  • 70,514
  • 10
  • 99
  • 103