jeudi 9 avril 2015

Classic asp - function that make the length of a string to be shorter

I have an asp code, that i wrote. It should take a string and check how many words there is in it, if there is less than 15 words, it returns the string. if there is more than 15 words, it returns the first 15 words.


But the function doesn't return anything. (or return null or ""). Can you take a look please and tell me what is wrong with it?



function write(inptTxt)
txt = " "
if inptTxt <> "" AND inptTxt <> " " then
stringArr = split(inptTxt," ")
if UBound(stringArr) < 15 then
txt = inptTxt
else
For i=0 To 15
txt = stringArr(i)
Next
end if
end if
write = txt


end function


Aucun commentaire:

Enregistrer un commentaire