Function for Wraping the Text in Web Applications

Chikul
Posted by Chikul under ASP.NET category on | Views : 1264
' Purpose : Function for Wraping the Text in Web Applications
' Variable : Variable strin,charcount

    Public Function wrap(ByVal strin As String, ByVal charcount As Integer) As String
Dim str As String = strin
strin = ""
Dim i As Integer
Dim cou As Integer = str.Length Mod charcount
If str.Length <= charcount Then
strin = str.Substring(0)
ElseIf str.Length > charcount Then
Dim n As Integer = str.Length - cou
For i = 0 To (n / charcount) - 1
strin += str.Substring((i * charcount), charcount) & "<BR />"
Next
If cou <> 0 Then
strin += str.Substring((i) * charcount, cou)
End If
End If
Return strin
End Function

Comments or Responses

Login to post response