08. august 2016 - 21:26Der er
3 kommentarer og 1 løsning
OverFlowException was unhandled by user code
Jeg bruger denne function som er fundet på nettet. Men får fejlen: *OverFlowException was unhandled by user code* Tips: Make sure you are not dividing by zero.
Function CountWord(ByVal inputString) Dim pos, spaceCount pos = 1 spaceCount = 1 While Not pos = Len(inputString) If Mid(inputString, pos, 1) = " " Then <--------- LINIEN HER --------- If Not pos = 1 Then If Not Mid(inputString, pos - 1, 1) = " " Then spaceCount = spaceCount + 1 End If End If End If pos = pos + 1 End While CountWord = spaceCount End Function
Function CountWordAltA(s As String) As Integer Return s.Trim().Split(" "C).Length End Function Function CountWordAltB(s As String) As Integer Return s.Trim().ToCharArray().Count(Function(c) c = " "C) + 1 End Function
Jeg brugte en af dine functioner arne_v Meget mere enkelt ;-)
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.