6 kyu

Strip Url Params

2,723 of 4,429jhoffner

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 Trained9798
Total Skips2461
Total Code Submissions54063
Total Times Completed4429
JavaScript Completions2723
Python Completions1649
Ruby Completions75
Total Stars227
% of votes with a positive feedback rating84% of 712
Total "Very Satisfied" Votes517
Total "Somewhat Satisfied" Votes160
Total "Not Satisfied" Votes35
Ad
Contributors
  • jhoffner Avatar
  • pioraid Avatar
  • Voile Avatar
  • FArekkusu Avatar
  • cveneziani Avatar
Ad