Java – remove URL prefix (http: /, WWW, etc.) from string [closed]

I need to remove various "web beginnings" from my string

My textview must not have "http: / /", "http: / / www.", "www" and other URL prefixes

Would you please help me

Solution

You can do this using regular expressions

"www.aaa".replaceFirst("^(http://www\\.|http://|www\\.)","")
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>