How I can change whitespace in string to URL %20 sign?


    Mar 09 2012 | 1:24 pm
    I have string with space in it and I want to send it via jit.uldl but i am having trouble to encode white space and sending it. Is there a way to replace all white spaces with given char set?

    • Mar 09 2012 | 3:45 pm
      [regexp]
    • Mar 09 2012 | 5:32 pm
      You can use [\W]* and the @substitute attribute of regexp. Notice how you have to "escape" the '%' sign with another one:
    • Mar 09 2012 | 6:53 pm
      disagree, I'd use [regexp \s @substitute %%20]
      (\W)* will match any non-word character (eg "-"), and replace multiple successive occurrences by just one %20.
      The difference is highlighted in this patch
    • Mar 09 2012 | 7:20 pm
      big_pause, big ups. \s is the better way to go.
      -Ben
    • Aug 14 2015 | 12:13 am
      In your way you become a dobled % sign