Android Question Array from range


Active Member
Licensed User
Longtime User
Is there a way in B4A to create an array from a range, specifically letters? I can loop through the integers fine, but need to create arrays of varying lengths using letters. (C,D,E,F,G)

Converting a PHP site, and looking for a way to duplicate the following without typing it out

$arr = array_merge(range(0, 9), range("B", "Z"), range("g", "z"));



Licensed User
Longtime User
You could create a string with the value "A......Z" and then use SubString2 to get the range, that of course has to be done in a sub.
Last edited:
Upvote 0


B4X founder
Staff member
Licensed User
Longtime User
Sub Activity_Create(FirstTime As Boolean)
   Dim arr() As String = range("a", "z")
End Sub

Sub Range(First As Char, Last As Char) As String()
   Dim i1 As Int = Asc(first)
   Dim i2 As Int= Asc(last)
   Dim res(i2 + 1 - i1) As String
   For i = i1 To i2
     res(i - i1) = Chr(i)
   Return res
End Sub
Upvote 0