% @LANGUAGE = "VBScript" %> <% '-------------------------------------------------------------------------- 'Fonction pour bien finir les phrases '-------------------------------------------------------------------------- Function CropSentence(strText, intLength, strTrial) Dim intPosition 'As Integer Dim intMaxLength 'As Integer Dim strOutput 'As String 'Set the max length to be the desired length minus 'the length of the trailing characters. intMaxLength = intLength - Len(strTrial) 'Check if the max length is less than or equal to zero. If intMaxLength <= 0 Then 'Return an empty string. CropSentence = "" 'Check if the inputted text it is less that the desired length. ElseIf Len(strText) <= intLength Then 'Return the inputted text CropSentence = strText 'Crop the sentance Else 'Remove the end of the text. strOutput = Left(strText, intLength) 'Get the position of the last space in the text. intPosition = InStrRev(strOutput, " ") 'Return the cropped sentance CropSentence = Left(strOutput, intPosition - 1) & strTrial End If End Function '-------------------------------------------------------------------------- 'FIN de la Fonction pour bien finir les phrases '-------------------------------------------------------------------------- 'Response.Buffer = True %>