By JCaisip
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("@") Thensb.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