1st string ;0;80;0;0;39;0;0;0;81;42;5;100;0;0 in this string there are
6 Nos.
2nd string ;11;0;5;2;0;0;0;0;89;65;0;26;0;2;5 in this line there are 8
Nos.
3rd string ;0;0;0;0;50;41;20;30;0;50;0 in this line there are 5 Nos.
I can count total nos in string
1st string -14 Nos.
2nd string -15 Nos.
3rd String - 11 Nos.
can anyone help please?
Thank You.
You could use a For... Next loop and the Len() function to inspect each
character.
Good luck!
Regards
Jeff Boyce
Microsoft Office/Access MVP
<billy...@gmail.com> wrote in message
news:fb2acb95-def6-4986...@34g2000hsf.googlegroups.com...
str_TempIn = Trim(str_Input)
L_TempIn = Len(str_TempIn)
L_Delim = Len(str_Delimiter)
I_Last = L_TempIn - L_Delim + 1
For I = 1 To I_Last
If Mid$(str_TempIn, I, L_Delim) = _
str_Delimiter Then N = N + 1
Next I
N = N + 1 ' There will always be at least one output
ReDim strary_Output(N)
I = 0
Found_At = _
InStr(str_TempIn, str_Delimiter)
While Found_At > 0
If Found_At = 1 Then
I = I + 1
strary_Output(I) = ""
Else
I = I + 1
strary_Output(I) = _
Mid$(str_TempIn, 1, Found_At - 1)
End If
If Found_At + L_Delim <= L_TempIn Then
str_TempIn = Mid$(str_TempIn, _
Found_At + L_Delim)
L_TempIn = Len(str_TempIn)
Else
str_TempIn = ""
L_TempIn = 0
GoTo Done
End If
Found_At = InStr(str_TempIn, _
str_Delimiter)
Wend
Done:
If Len(str_TempIn) > 0 Then
I = I + 1
strary_Output(I) = str_TempIn
End If
Load_Array_from_String = N
End Function
Public Function CountNumbers(strIn As String, D As String) As Integer
Dim I as Integer
Dim N As Integer
Dim C As Integer
Dim strResult() As String
C = 0
N = Load_Array_from_String(strIn,D,strResult)
For I = 1 to N
If IsNumeric(strResult(I) Then
C = C + 1
End If
Next I
CountNumbers = C
End Function
-----------------------------
N = CountNumbers("X;0;5;10;30;Y;45",";")
N will have value of 5, it will skip over the X and Y
varNumbers = Split(strList, ";")
For lngX = 0 To Uboud(varNumbers)
If varNumbers(lngx) <> 0 Then
NumberCount = NumberCount + 1
End If
Next LngX
End Function
--
Dave Hargis, Microsoft Access MVP
Sorry about the oversight, You need to test for that condition as well so
you don't count it as a number.
--
Dave Hargis, Microsoft Access MVP