Jonisium Experiment
Or login with [ JE account ]
Web experiment is fun! Innovation and ideas for the future.
Welcome to the site of
jonisium
  Blog

How do real developers display twitter timelines in ASP.NET MVC and VB.NET?
01/03/2010

By JCaisip

Share this page Del.icio.us Post on Twitter facebook

While learning on twitter API, I realized the timelines are sent as clear text. Screen names are sent with "@" at the beginning of the word which is a good thing to indicate that is a username. In order to display timelines similar to how Twitter renders @screenname i came out with a function in vb.net.

I do coding for fun and I have no experience in a real project web development. I want to know how do real web developers will code something similar to the function below?


        Function FormatTwitterStatus(ByVal Str As String) As String
            ' this function display twitter screen name as a url link
            Dim words() As String = Str.Split(" ")
            Dim sb As New StringBuilder
            For Each word In words
                If word.Contains("@") Then

                    sb.Append("@<a href='http://twitter.com/" & word.Replace("@", "") & _
"'>" & word.Replace("@", "") & "</a> ")
                Else
                    If word.Contains("http") Then
                        sb.Append("<a href='" & word & "'>" & word & "</a> ")
                    Else
                        sb.Append(word & " ")
                    End If
                End If
            Next
            sb.Replace(Chr(39), Chr(34))
            Return sb.ToString.TrimEnd()
        End Function




More Blog listing

User Comments

 

Feedback Form
*
*
*
*