@ThreadSafe
public final class UrlStringUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
containsUrl(java.lang.String text)
Tests if the text provided contains a URL.
|
static java.util.List<java.lang.String> |
extractImportantUrlData(java.lang.String text)
Takes a URL, in String format, and adds the important parts of the URL to
a list of strings.
|
static boolean |
isUrl(java.lang.String text)
Tests if the given text is url.
|
public static boolean containsUrl(java.lang.String text)
text
- the text to searchpublic static boolean isUrl(java.lang.String text)
text
- the string to testpublic static java.util.List<java.lang.String> extractImportantUrlData(java.lang.String text) throws java.net.MalformedURLException
Takes a URL, in String format, and adds the important parts of the URL to a list of strings.
Example, given the following input:
"https://www.somedomain.com/path1/path2/file.php?id=439"
The function would return:
{"some.domain", "path1", "path2", "file"}
text
- a URLjava.net.MalformedURLException
- thrown if the URL is malformedCopyright© 2012-21 Jeremy Long. All Rights Reserved.