Add http://www. in the text if not Exist

前端 未结 6 635
迷失自我
迷失自我 2021-02-08 21:31

How can I know that some text contain \"http://www.\" I want to show domain in Web View. Domain name is written in TextView but there is no restriction to add prefix. If user di

6条回答
  •  别那么骄傲
    2021-02-08 22:13

    The most efficient way of checking that the domain name is well formed and contains (or not) a prefix, is using a regular expression.

    Check out Java Pattern to match regex in Android. It is worth it.

提交回复
热议问题