VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



The code finds the numerical values in an array that consists of many characters including numbers

by BARKIN ¨N¨ULU (1 Submission)
Category: Math/Dates
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 24th August 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

The code finds the numerical values in an array that consists of many characters including numbers

Rate The code finds the numerical values in an array that consists of many characters including numbers




  Dim length As Long
  Dim NumberArray() As Variant
  length = Len(Text1.Text)
  ReDim NumberArray(CountNumber((Text1.Text)))
   j = 0
    For i = 1 To length
       If IsNumeric(Mid(Text1.Text, i, 1)) Then
        NumberArray(j) = Mid(Text1.Text, i, 1)
        j = j + 1
  End If
Next i
  For i = 0 To UBound(NumberArray)
     List1.AddItem NumberArray(i)
  Next i


End Sub

Private Function CountNumber(metin As Variant) As Long
  Dim i, result As Long
  Dim length As Long
    length = Len(metin)
    result = 0
     For i = 1 To length
       If IsNumeric(Mid(Text1.Text, i, 1)) Then
         result = result + 1
       End If
     Next i
     CountNumber = result
End Function


Download this snippet    Add to My Saved Code

The code finds the numerical values in an array that consists of many characters including numbers Comments

No comments have been posted about The code finds the numerical values in an array that consists of many characters including numbers. Why not be the first to post a comment about The code finds the numerical values in an array that consists of many characters including numbers.

Post your comment

Subject:
Message:
0/1000 characters