Converting string into hyperlink

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jijoja
    New Member
    • Mar 2007
    • 5

    Converting string into hyperlink

    Hey there!
    Does anyone have a ready to plugin function that takes as an argument arbitrary long string and converts links written as a string into actual links.
    For example:
    Input string is: Please, visit our website http://www.thescripts. com and find out more about programmers community. You can also go to http://www.thescripts. com/forum/archive/index.php/f-130.html if you need help in yari, yari, yari.

    Output of the function should be:
    Please, visit our website <a href=”http://www.thescripts. com”> http://www.thescripts. com</a> and find out more about programmers community. You can also go to <a href=”http://www.thescripts. com/forum/archive/index.php/f-130.html”> http://www.thescripts. com/forum/archive/index.php/f-130.html </a> if you need help in yari, yari, yari.

    I start with String function indexOf(“http”) but after that I get stuck. I mean I can come up with algorithm but it is so inefficient and easy to get lost in. After finding first occurrence of http I use substring, tokenizer, split etc. Does not look right. I am working on free community website and want people to add their posts with links to their website's. As of now, this is the only thing that is missing. Any help would be appreciated.
  • jijoja
    New Member
    • Mar 2007
    • 5

    #2
    Fellows, don't bother. I am through with this function. Easy one if enough time and thoughts are invested. Just about 10 lines of code. Take care. Have a nice day.

    Comment

    Working...