Here you can find the source of isValidURIorEmpty(String uri)
Parameter | Description |
---|---|
uri | a parameter |
public static boolean isValidURIorEmpty(String uri)
//package com.java2s; //License from project: LGPL import java.net.URI; public class Main { /**//from w ww . j av a 2s. c o m * Check if the given input string is a valid URI * @param uri * @return */ public static boolean isValidURIorEmpty(String uri) { if (uri == null || uri.trim().isEmpty()) { return true; } try { URI.create(uri); return true; } catch (Exception e) { return false; } } }