Here you can find the source of isURL(final String urlString)
Parameter | Description |
---|---|
url | Possible URL |
true
if considered a URL
@SuppressWarnings("nls") public static boolean isURL(final String urlString)
//package com.java2s; /******************************************************************************* * Copyright (c) 2010 Oak Ridge National Laboratory. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html ******************************************************************************/ import java.net.URL; public class Main { /** Check if a URL is actually a URL * @param url Possible URL/*from w w w . j av a 2 s .c o m*/ * @return <code>true</code> if considered a URL */ @SuppressWarnings("nls") public static boolean isURL(final String urlString) { try { new URL(urlString); } catch (Exception e) { return false; } return true; // return urlString.contains(":/"); //$NON-NLS-1$ } }