programming-examples/asp/Strings/Cut Off.asp
2019-11-18 14:25:58 +01:00

24 lines
641 B
Plaintext

<%
function cutOff(chkString,sNum)
'Is the string empty?
if IsNull(chKString) = False And chkString > sNum Then
strTot = Len(chkString)
'Eliminate blank spaces off the end, nee
' ded for SQL 6.5
While Right(chkString, 1) = " "
chkString = Left(chkString, strTot - 1)
strTot = Len(chkString)
Wend
'Cut it down
chkString = Left(chkString, sNum)
'One last check for blank spaces
if Right(chkString, 1) = " " Then
chkString = Left(chkString, sNum - 1)
End if
'Indicate truncation
if Len(chkString) <> strTot Then chkString = chkString & "..."
'Return string
cutOff = chkString
End if
End function
%>