@Test public void testIsUrlWithProtocol() { Assert.assertTrue(Urls.isUrlWithProtocol("http: Assert.assertTrue(Urls.isUrlWithProtocol("protocol:")); Assert.assertFalse(Urls.isUrlWithProtocol("protocol")); Assert.assertFalse(Urls.isUrlWithProtocol(":/")); Assert.assertFalse(Urls.isUrlWithProtocol("1:/")); Assert.assertFalse(Urls.isUrlWithProtocol(null)); }
public static boolean isUrlWithProtocol(String x) { if (x==null) return false; for (int i=0; i<x.length(); i++) { char c = x.charAt(i); if (c==':') return i>0; if (!Character.isLetter(c)) return false; } return false; }
Urls { public static boolean isUrlWithProtocol(String x) { if (x==null) return false; for (int i=0; i<x.length(); i++) { char c = x.charAt(i); if (c==':') return i>0; if (!Character.isLetter(c)) return false; } return false; } }
Urls { public static boolean isUrlWithProtocol(String x) { if (x==null) return false; for (int i=0; i<x.length(); i++) { char c = x.charAt(i); if (c==':') return i>0; if (!Character.isLetter(c)) return false; } return false; }  }
Urls { public static boolean isUrlWithProtocol(String x) { if (x==null) return false; for (int i=0; i<x.length(); i++) { char c = x.charAt(i); if (c==':') return i>0; if (!Character.isLetter(c)) return false; } return false; }  static Function<String,URI> stringToUriFunction(); static Function<String,URL> stringToUrlFunction(); static final URL toUrl(@Nullable String url); static final URL toUrl(@Nullable URI uri); static final URI toUri(@Nullable String uri); static final URI toUri(@Nullable URL url); static boolean isUrlWithProtocol(String x); static String mergePaths(String ...items); @SuppressWarnings("deprecation") static String encode(String text); @SuppressWarnings("deprecation") static String decode(String text); static String getProtocol(String url); static String getBasename(String url); static boolean isDirectory(String fileUrl); static File toFile(String fileUrl); static String asDataUrlBase64(String data); static String asDataUrlBase64(MediaType type, byte[] bytes); }
Urls { public static boolean isUrlWithProtocol(String x) { if (x==null) return false; for (int i=0; i<x.length(); i++) { char c = x.charAt(i); if (c==':') return i>0; if (!Character.isLetter(c)) return false; } return false; }  static Function<String,URI> stringToUriFunction(); static Function<String,URL> stringToUrlFunction(); static final URL toUrl(@Nullable String url); static final URL toUrl(@Nullable URI uri); static final URI toUri(@Nullable String uri); static final URI toUri(@Nullable URL url); static boolean isUrlWithProtocol(String x); static String mergePaths(String ...items); @SuppressWarnings("deprecation") static String encode(String text); @SuppressWarnings("deprecation") static String decode(String text); static String getProtocol(String url); static String getBasename(String url); static boolean isDirectory(String fileUrl); static File toFile(String fileUrl); static String asDataUrlBase64(String data); static String asDataUrlBase64(MediaType type, byte[] bytes);  }