Request parser

  • 16
  • Locked
Read a URL from the console. Then display a space-delimited list of all the parameters (The parameters follow the "?" and are separated by "&", e.g. "lvl=15"). The URL contains at least 1 parameter. If the obj parameter is present, pass its value to the relevant alert method.
You can't complete this task, because you're not signed in.
Comments(4)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
yehuda bLevel 17 , Beersheba
24 June, 18:39
Wow! I see from all the comments here and from the questions in the help section, that I literally reinvented the wheel (Although I did see others doing similar types of algorithms). Basically, I ended up creating two Arraylists, one with all the individual characters of the URL, and one <Integer> with the indexes of characters '=' and '&'. next I looped through the second Arraylist using its elements to get to = and & indexes of the first Arraylist and creating subStrings out of it to print to the console. next I checked if any of the subStrings equal "obj" to call alert methods. I spent from last Thursday to this Wednesday on it (because i had resolved not to use the help section or comments) even asking at one point, a question on stackoverflow [that was down-voted thrice within 15 minutes]. What a waste of TIME! :-)
Liliane TopLevel 17 , Amsterdam
13 April, 07:45
for more info about the topics in this task see: https://www.freeformatter.com/url-parser-query-string-splitter.html
AhmedLevel 23 , Amsterdam
1 June 2019, 10:20
hint: use URL api and string.split to solve this one Thank me later :)
Ed MaphisLevel 20 , Painesville
8 June 2019, 15:02
I didn't use URL, but split came in handy.