E erovia New Member May 16, 2016 #1 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: May 16, 2016
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???
Erel B4X founder Staff member Licensed User Longtime User May 17, 2016 #2 B4X: For i = 0 To s.Length - 1 Dim c As String = s.CharAt(i) Next erovia said: how can i convert strings to floats??? Click to expand... You don't need to do anything special: B4X: Dim f As Float = "12.34" 'or better If IsNumber(inprogress.Text) Then f = inprogress.Text Else Msgbox("Error", "") End If Upvote 0
B4X: For i = 0 To s.Length - 1 Dim c As String = s.CharAt(i) Next erovia said: how can i convert strings to floats??? Click to expand... You don't need to do anything special: B4X: Dim f As Float = "12.34" 'or better If IsNumber(inprogress.Text) Then f = inprogress.Text Else Msgbox("Error", "") End If
eurojam Well-Known Member Licensed User Longtime User May 17, 2016 #3 you can iterate a string like this: B4X: 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: B4X: Dim s As String = "5.2" Dim f As Double If IsNumber(s) Then f = s End If Upvote 0
you can iterate a string like this: B4X: 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: B4X: Dim s As String = "5.2" Dim f As Double If IsNumber(s) Then f = s End If