-
alphabetizing parameters
Hello,
I am very new to Java and my knowledge of it is VERY limited. I have been asked to try and develope a Java method that will take the URL string and alphabetizes the parameters. I have no idea where to start or even where to look to try and help myself out. Any help would be greatly appreciated.
-
The String class has many useful methods for this sort of thing. I don't want to do your homework for you, but here are some pointers:
URL parameters are easy to find in a URL, e.g. prefix.yoururl.whatever<b>?param1=value1¶m2=va lue2¶m3=value3</b>
Try
1. Converting the URL to a string.
2. Clipping the string at the question-mark, to retain just the parameter list.
3. Using the indexOf method (for example, you could also use regular expressions to great effect here) to split the remainder into parameters and values.
Good Luck,
Joe
-
what do you think about about using the String.split() method?