Prikazi cijelu temu 11.06.2018 22:50
Gjoreski Van mreze
Administrator
Registrovan od:02.02.2009
Lokacija:Ohrid Makedonija


Predmet:Izvlacejne Broj od stinga sa decimalom
Ako nekome zatreba :

PreuzmiIzvorni kôd (Visual Basic):
  1. Public Function Extract_Number_With_Decimal(Phrase As String) As Double
  2. Dim Length_of_String As Integer
  3. Dim Current_Pos As Integer
  4. Dim Temp As String
  5. Length_of_String = Len(Phrase)
  6. Temp = ""
  7. For Current_Pos = 1 To Length_of_String
  8. If (Mid(Phrase, Current_Pos, 1) = "-") Then
  9.   Temp = Temp & Mid(Phrase, Current_Pos, 1)
  10. End If
  11. If (Mid(Phrase, Current_Pos, 1) = ".") Then
  12.  Temp = Temp & Mid(Phrase, Current_Pos, 1)
  13. End If
  14. If (IsNumeric(Mid(Phrase, Current_Pos, 1))) = True Then
  15.     Temp = Temp & Mid(Phrase, Current_Pos, 1)
  16.  End If
  17. Next Current_Pos
  18. If Len(Temp) = 0 Then
  19.     Extract_Number_With_Decimal = 0
  20. Else
  21.     Extract_Number_With_Decimal = CDbl(Temp)
  22. End If
  23. End Function
Ovaj post je ureden 2 puta. Posljednja izmjena 13.06.2018 08:51 od strane Avko.