A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Joined: Aug 18, 2005
Aug 20, 2005 15:15:00
I have a Srting that is passed to me. I need to verify that the
passed is an object of a URLEncodedString class. I request you guys for an idea how to do it.
Thomas Paul Bigbee
Joined: Jun 28, 2005
Aug 20, 2005 15:49:00
Create a boolean good flag
Try and create URL object with your string
if the object can be created, set the good flag to true
else catch the exception and take appropriate action.
public URL(String spec)
Creates a URL object from the String representation.
This constructor is equivalent to a call to the two-argument constructor with a null first argument.
spec - the String to parse as a URL.
MalformedURLException - If the string specifies an unknown protocol.
Joined: Aug 10, 2005
Aug 20, 2005 15:55:00
Where is the URLEncodedString class defined?
I find something with a similiar name: java.net.URLEncoder in the 1.5 doc.
If you are asking how to detect if a String has been encoded:
You could run it thru the decode and then encode it and compare to original.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014