1
I need to pass some VB6 codes for PHP but I have a question of what this code does:
Private Function SomarValor(v As String) As Double
Dim x As Byte, resultado As Double
For x = 1 To Len(v)
resultado = resultado + CDbl(Mid(v, x, 1))
Next
SomarValor = resultado
End Function
This function SomarValor()
receives values such as 0202827610
, if anyone can help.
I have tried to look up the meaning of these internal functions as CDbl
, Mid
, but I couldn’t understand.
Yes it is possible the
mid()
is equivalent tosubstr()
– rray
right, but what this does
For x = 1 To Len(v)
and this function "Cdbl", would you explain to me, please?– David Santos
If I understand correctly, he reads
0202827610
character by character and sum the result.– rray