Classic ASP Trim function

It’s your if statement which is killing you…

<%
 Function TrimEnd(strInput, intLength)
    arrWords = Split(strInput, " ")
    if UBound(arrWords) <= intLength then
          TrimEnd = strInput    
    else
          strTemp = ""
          For intCounter = 0 to intLength
                strTemp = strTemp & " " & arrWords(intCounter)
          Next
          TrimEnd = strTemp 
    end if
 End Function 

Function SkipWords(strInput, intLength)
    arrWords = Split(strInput, " ")
    if UBound(arrWords) <= intLength then
          SkipCount = ""    
    else
          strTemp = ""
          For intCounter = intLength to UBound(arrWords)
                strTemp = strTemp & " " & arrWords(intCounter)
          Next
          SkipWords = strTemp 
    end if
 End Function 

=TrimEnd(description, 10) 
=SkipWords(description, 10) 
%>