Limit Title Character...

<%
Function neatTrim( strToTrim, desiredLength )
strToTrim = trim( strToTrim )

if len( strToTrim ) < desiredLength then

neatTrim = strToTrim

exit function

else

if inStrRev( strToTrim, " ", desiredLength ) = 0 then

strToTrim = left( strToTrim, desiredLength - 1 ) & "&#133;"

else

strToTrim = left( strToTrim, inStrRev( strToTrim, " ", desiredLength + 1 ) -1 ) & "&#133;" 'no carriage return here

end if

end if

neatTrim = trim( strToTrim )

End Function


strLong = " This string is too long! "

strTrimmed = NeatTrim( strLong, 13 )

response.write( strTrimmed )
%>

阅读更多
文章标签: function string
个人分类: asp
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭