Here you can find the source of isValidURL(CharSequence urlStr)
Parameter | Description |
---|---|
urlStr | The URL string to test |
public static boolean isValidURL(CharSequence urlStr)
//package com.java2s; //License from project: Apache License import java.net.URL; public class Main { /**// ww w . jav a 2s. co m * Determines if the passed string is a valid URL * @param urlStr The URL string to test * @return true if is valid, false if invalid or null */ public static boolean isValidURL(CharSequence urlStr) { if (urlStr == null) return false; try { new URL(urlStr.toString()); return true; } catch (Exception e) { return false; } } }