Returning a href within a string

Posted by user701254 on Stack Overflow See other posts from Stack Overflow or by user701254
Published on 2012-06-16T14:51:01Z Indexed on 2012/06/16 15:16 UTC
Read the original article Hit count: 148

Filed under:
|

How can I return a href within a string, I can access the start position but not sure how to get last position :

Here is what I have so far :

    String str = "sadf ad fas dfa http:\\www.google.com sdfa sadf as dfas";

    int index = str.indexOf("http");
    String href = str.substring(index , ???);

What should the end index be ?

Note, this is targeted at j2me & I need to minimise download footprint so I cannot use regular expressions or third party regular expressions libraries.

© Stack Overflow or respective owner

Related posts about java

Related posts about java-me