URL

  • Thread starter Thread starter anonym
  • Start date Start date
A

anonym

I am trying to get the URL from the user and then set it
for a webservice. This fails when the URL is not of the
right format and gives me URIFormatException. My question
is : Is there anything I could use in my form so that I
check for teh right format for URL even before calling the
webserver method?

Thanks in advance
 
You can try to instantiate a Uri object with the URL and catch any
exceptions that it may throw. If the object can be created, it is a valid
URL.
 
Back
Top