如何解析从Android的一个字符串的URL? [英] How to parse a url from a String in android?
问题描述
我想从Android中的String解析URL。这个例子字符串是
I want to parse the url from a String in android. The example String is
"This is a new message. The content of the message is in 'http://www.example.com/asd/abc' "
我想解析URL http://www.example.com/asd/abc
从字符串不使用的子方法。
I want to parse the url http://www.example.com/asd/abc
from the String without using the subString method.
推荐答案
更新:
您可以使用普通的EX pression与<一个href="http://developer.android.com/reference/android/util/Patterns.html"><$c$c>Patterns.WEB_URL$c$c>常规的前pression找到所有的URL文本。
You can use regular expression with Patterns.WEB_URL
regular expression to find all urls in your text.
原文:
您可以使用<一个href="http://developer.android.com/reference/android/net/Uri.html#parse%28java.lang.String%29"><$c$c>Uri.parse(String uriString中) 功能。
You can use Uri.parse(String uriString)
function.
这篇关于如何解析从Android的一个字符串的URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!