Here you can find the source of isValid(String candidateUrl)
Parameter | Description |
---|---|
candidateUrl | The candidate string to validate. |
public static boolean isValid(String candidateUrl)
//package com.java2s; //License from project: Apache License import java.net.MalformedURLException; import java.net.URL; public class Main { /**//from w w w. j a va2s . c o m * Check if a given string is a valid url format. * * @param candidateUrl The candidate string to validate. * @return true if the candidateUrl string is a valid url string. */ public static boolean isValid(String candidateUrl) { try { URL url = new URL(candidateUrl); return true; } catch (MalformedURLException e) { return false; } } }