Android Question iterate a string

erovia

New Member
hi
how can i iterate a string?
this is what I've tried :
For i = 0 To inprogress.Text.Length - 1
A(i) = inprogress.Text(i)
Next

and also another question :
how can i convert strings to floats???
 
Last edited:
Code: Copy
For i = 0 To s.Length - 1
   Dim c As String = s.CharAt(i)
Next

how can i convert strings to floats???
You don't need to do anything special:
Code: Copy
Dim f As Float = "12.34"
'or better
If IsNumber(inprogress.Text) Then
 f = inprogress.Text
Else
 Msgbox("Error", "")
End If
 
Upvote 0
you can iterate a string like this:
Code: Copy
Dim s As String
Dim letter As String
For i = 0 To s.Length-1
    letter = s.SubString2(i,i+1)
Next

to convert a string to floats you can do it lile this:
Code: Copy
Dim s As String = "5.2"
Dim f As Double

If IsNumber(s) Then
    f = s
End If
 
Upvote 0
Back
Top