Limit the string value to given number of characters but dont break the word
Function TrimString(ByVal strString, ByVal intLength) Dim aryString As String() strString = Replace(strString, vbCrLf, "") If Len(strString) > intLength Then strString = Left(strString, intLength) aryString = Split(strString, " ") strString = "" For a As Integer = 0 To UBound(aryString) - 1 strString = strString & " " & aryString(a) Next strString = Trim(strString) strString = strString & "..." End If TrimString = strString End Function
No comments:
Post a Comment