strInputText = "Dette er min tekst!" Response.Write GetWordCount(strInputText) Function GetWordCount(strInput) Dim strTemp
' Deal with tabs and carriage returns ' by replacing them with spaces. strTemp = Replace(strInput, vbTab, " ") strTemp = Replace(strTemp, vbCr, " ") strTemp = Replace(strTemp, vbLf, " ")
' Remove leading and trailing spaces strTemp = Trim(strTemp)
' Combine multiple spaces down to single ones Do While InStr(1, strTemp, " ", 1) <> 0 strTemp = Replace(strTemp, " ", " ") Loop
' Get a count by splitting the string into an array ' and retreiving the number of elements in it. ' I add one to deal with the 0 lower bound. GetWordCount = UBound(Split(strTemp, " ", -1, 1)) + 1 End Function ' GetWordCount
det blev den eagleeye gav mig der blev brugt takker for hjælpen.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.