mirror of
https://github.com/markusfisch/BinaryEye.git
synced 2024-09-20 03:52:16 +02:00
Remove unused getLinks() function
No longer used.
This commit is contained in:
parent
282d2499a8
commit
f23414b003
@ -1,29 +0,0 @@
|
||||
package de.markusfisch.android.binaryeye.app
|
||||
|
||||
import java.util.regex.Pattern
|
||||
|
||||
private val urlPattern: Pattern = Pattern.compile(
|
||||
"(?:^|[\\W])((ht|f)tp(s?):\\/\\/|www\\.)" +
|
||||
"(([\\w\\-]+\\.){1,}?([\\w\\-.~]+\\/?)*" +
|
||||
"[\\p{Alnum}.,%_=?&#\\-+()\\[\\]\\*$~@!:/{};']*)",
|
||||
Pattern.CASE_INSENSITIVE or Pattern.MULTILINE or Pattern.DOTALL
|
||||
)
|
||||
|
||||
fun getLinks(text: String): List<String> {
|
||||
val matcher = urlPattern.matcher(text)
|
||||
val urls = mutableListOf<String>()
|
||||
|
||||
while (matcher.find()) {
|
||||
val matchStart = matcher.start(1)
|
||||
val matchEnd = matcher.end()
|
||||
|
||||
var url = text.substring(matchStart, matchEnd)
|
||||
if (!url.startsWith("http://") && !url.startsWith("https://")) {
|
||||
url = "https://$url"
|
||||
}
|
||||
|
||||
urls.add(url)
|
||||
}
|
||||
|
||||
return urls
|
||||
}
|
Loading…
Reference in New Issue
Block a user