Android String to URL Convert findUrl(StringBuilder sb)

Here you can find the source of findUrl(StringBuilder sb)

Description

find Url

Declaration

public static final StringBuffer findUrl(StringBuilder sb) 

Method Source Code

//package com.java2s;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

    public static final StringBuffer findUrl(StringBuilder sb) {
        Pattern pattern = Pattern
                .compile("(http://|https://){1}[\\w\\.\\-/:]+");
        Matcher matcher = pattern.matcher(sb);
        StringBuffer buffer = new StringBuffer();
        while (matcher.find()) {
            String s = matcher.group(1);
            matcher.appendReplacement(buffer, "<a href=\"" + s + "\">" + s
                    + "</a>");
        }//www.  ja v a  2  s.c  om
        matcher.appendTail(buffer);
        return buffer;
    }
}

Related

  1. isUrl(String str)
  2. isUrl(String s)
  3. isUrlValid(String str)
  4. isHttpUrl(String input)
  5. getDomain(String url)
  6. isImageUrl(String imgUrl)
  7. getBaseUrl(String pageUrl)
  8. getYoutubeId(String url)
  9. preUrl(String url)