6 kyu

Strip Url Params

2,720 of 4,420jhoffner

Description:

Complete the method so that it does the following:

  • Removes any duplicate query string parameters from the url (the first occurence should be kept)
  • Removes any query string parameters specified within the 2nd argument (optional array)

Examples:

stripUrlParams('www.codewars.com?a=1&b=2&a=2') === 'www.codewars.com?a=1&b=2'
stripUrlParams('www.codewars.com?a=1&b=2&a=2', ['b']) === 'www.codewars.com?a=1'
stripUrlParams('www.codewars.com', ['b']) === 'www.codewars.com'
strip_url_params('www.codewars.com?a=1&b=2&a=2') == 'www.codewars.com?a=1&b=2'
strip_url_params('www.codewars.com?a=1&b=2&a=2', ['b']) == 'www.codewars.com?a=1'
strip_url_params('www.codewars.com', ['b']) == 'www.codewars.com'
strip_url_params('www.codewars.com?a=1&b=2&a=2') == 'www.codewars.com?a=1&b=2'
strip_url_params('www.codewars.com?a=1&b=2&a=2', ['b']) == 'www.codewars.com?a=1'
strip_url_params('www.codewars.com', ['b']) == 'www.codewars.com'
Strings
Algorithms

Stats:

CreatedApr 9, 2013
PublishedApr 9, 2013
Warriors Trained9780
Total Skips2460
Total Code Submissions54023
Total Times Completed4420
JavaScript Completions2720
Python Completions1645
Ruby Completions73
Total Stars227
% of votes with a positive feedback rating84% of 709
Total "Very Satisfied" Votes515
Total "Somewhat Satisfied" Votes159
Total "Not Satisfied" Votes35
Ad
Contributors
  • jhoffner Avatar
  • pioraid Avatar
  • Voile Avatar
  • FArekkusu Avatar
  • cveneziani Avatar
Ad